: 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
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>
More posts by @Angela700
1 Comments
Sorted by latest first Latest Oldest Best
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.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.