Mobile app version of vmapp.org
Login or Join
Angela700

: Forward .html/.htm to .php with .config 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

@Angela700

Posted in: #Htaccess #Iis7

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:phpphp-cgi.exe"
resourceType="Either" />
</handlers>
</system.webServer>
</configuration>

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Angela700

1 Comments

Sorted by latest first Latest Oldest Best

 

@Marchetta884

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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme