2

I have a big site with lots of .html files, and I want to start using PHP in my pages, but I don't want to change the links to .php . I read on Apache servers you can add a rule to the .htaccess file that will allow PHP parsing in plain .html files. Is this possible in IIS?

2 Answers 2

2

Absolutely. Assuming you're using IIS7, you simply change the request path in "Handler Mappings" to *.html (to handle all html files).

Note that you'll get a big performance hit though. It's much quicker to serve static content, so if you have lots of html pages every single one of them will start being parsed by PHP. It would be preferable to switch pages to .php as needed, but I understand that it would be tricky to fix all the backlinks.

More information about setting it up is available here.

Sign up to request clarification or add additional context in comments.

1 Comment

good deal, I've made a request to the web host, I'll see what happens. Given that all our html pages would benefit from a nice header/footer/content/widgets template, I think I'm ok with incurring the extra overhead-
0

Be aware that when changing handler mappings you'll also want to make sure it is still sending the correct MIME types. I just implemented the solution Hamish linked to, but all my CSS @import directives were failing, as they were to pure .css files which were now being served with PHP's standard text/html Content-type header.

3 Comments

ended up using SSI (server side includes) instead-
How did SSI help with getting PHP to parse HTML files?
sry, that was vague, one of the reasons to start using php with the html pages was to be able to start using includes, so this solution was simpler-

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.