Skip to main content
Participating Frequently
March 23, 2017
Answered

How to embed PHP code in HTML document [was:Dreamweaver CC 2017]

  • March 23, 2017
  • 1 reply
  • 1797 views

I'm trying to embed PHP code inside an HTML page with a .html file extension. If I look at the local file using MAMP with a browser, it displays correctly. However, Dreamweaver refuses to parse the PHP content properly when it's located in an HTML file. Is there someway to enable this, like modifying a .htaccess file on a real server to accomplish the same thing?

    This topic has been closed for replies.
    Correct answer BenPleysier

    Dreamweaver will only help you with PHP when the file is appropriately named with a PHP extension. You can then change the extension in the .htaccess file by adding

    RewriteEngine on
    RewriteRule ^(.*)\.html$ $1.php

    When you access index.html the system will look for a file called index.php

    1 reply

    BenPleysier
    Community Expert
    BenPleysierCommunity ExpertCorrect answer
    Community Expert
    March 23, 2017

    Dreamweaver will only help you with PHP when the file is appropriately named with a PHP extension. You can then change the extension in the .htaccess file by adding

    RewriteEngine on
    RewriteRule ^(.*)\.html$ $1.php

    When you access index.html the system will look for a file called index.php

    Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!
    Participating Frequently
    March 23, 2017

    This works perfectly. Thank you for your prompt and expert answer!