How to run PHP codes in .html files using .htaccess while on ServerPilot?

Posted July 6, 2017 6.7k views
PHPUbuntu 16.04

I really need a help. How can I execute PHP codes in .html files while I’m on ServerPilot?
I tried lot of .htaccess tricks but nothing seems to work for me. You can checkout how ServerPilot works.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Hi @Dibbyo457

Did you try AddType or ForceType ?

Why not just use .php files instead of .html ? Just curious.

  • Tried all but does not work.
    Because AdSense does not accept .php in their backup ads section.

    • Okay. How about doing this instead - I don’t have Apache, so cannot test.

      RewriteEngine on
      RewriteRule ^(.+)\.html$ $1.php [L] 

      This would make so would actually load