Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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>
share|improve this question

migrated from serverfault.com Nov 19 '11 at 13:03

This question came from our site for professional system and network administrators.

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 –  PhilipK 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. –  PhilipK Nov 19 '11 at 20:46
    
Can you post the content of the orignal .htaccess file? –  Marco Miltenburg Nov 21 '11 at 18:20

1 Answer 1

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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