Question

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

Posted July 6, 2017 5k views
PHPUbuntu 16.04

Hello,
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.

×
1 answer

Hi @Dibbyo457

Did you try AddType or ForceType ?
https://stackoverflow.com/questions/6295141/server-not-parsing-html-as-php

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

Submit an Answer