1

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

EDIT

*Hosting provided by GoDaddy

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

<configuration>
<system.webServer>
    <handlers>
        <add name="PHP-FastCGI" verb="*" 
            path="*.html" 
            modules="FastCgiModule"
            scriptProcessor="c:\php\php-cgi.exe" 
            resourceType="Either" />
    </handlers>
</system.webServer>
</configuration>
5
  • 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. Nov 19, 2011 at 4:55
  • GoDaddy says it should work help.godaddy.com/article/5443 Nov 19, 2011 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. Nov 19, 2011 at 20:39
  • I developed the site on my server. They already have a server which they've paid for the next 2 years. Nov 19, 2011 at 20:46
  • Can you post the content of the orignal .htaccess file? Nov 21, 2011 at 18:20

1 Answer 1

2

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.

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

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 and acknowledge you have read our privacy policy.

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