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

July 6, 2017 502 views
PHP Ubuntu 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.

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 domain.com/example.html would actually load domain.com/example.php

Have another answer? Share your knowledge.