I'm moving a site from my linux hosted server to a client's windows hosted server.

The .htaccess file no longer works and I'm told that windows servers use .config .

How can I forward all users accessing .html & .htm files to the equivalent .php file.

Server Info...

OS/Hosting Type: Windows / Shared Hosting

.Net Runtime Version: ASP.Net 2.0/3.0/3.5

PHP Version: PHP 5.2

IIS Version: IIS 7.0

Data Center: US Regional


*Hosting provided by GoDaddy

Was told by a friend following should work but it has no effect on the site.

        <add name="PHP-FastCGI" verb="*" 
            resourceType="Either" />
  • 2
    What you're looking for is the IIS rewrite module, which may or may not be enabled on that shared host. Check with the provider. – Shane Madden Nov 19 '11 at 4:55
  • GoDaddy says it should work help.godaddy.com/article/5443 – Philip Kirkbride Nov 19 '11 at 15:44
  • "I'm moving a site from my linux hosted server to a client's windows hosted server." => How comes? (°.o) this is nonsense to me it's usually the opposite move. – Olivier Pons Nov 19 '11 at 20:39
  • I developed the site on my server. They already have a server which they've paid for the next 2 years. – Philip Kirkbride Nov 19 '11 at 20:46
  • Can you post the content of the orignal .htaccess file? – Marco Miltenburg Nov 21 '11 at 18:20

All that you have done in that code is enable PHP on the server. You need to either rewrite or redirect your .html pages to the corresponding .php pages with the IIS URL Rewriter.

Something like this might work for you. Put it in system.webServer.

        <rule name="REWRITE_TO_PHP">
        <match url="^(.+).html$" />
        <conditions logicalGrouping="MatchAll" />
        <action type="Rewrite" url="{R:2}.php" />

This is pretty simplistic and I am not at work to test it out, but it should get you started. You will have to adjust the RegEx accordingly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.