我想从url中删除扩展名.php,以便mysite.com/home.php可以像mysite.com/home一样工作。IIS web.config启用重写规则
我在1and1.com上托管我的网站,并询问他们是否打开了重写引擎,并且他们说,对于运行IIS 7.5的Windows服务器,它未打开,我可以打开它web.config文件中的一些代码。
我一直没有找到能够开启重写规则的代码。
下面是我试图用来重写网址的内容。但是我得到一个错误500.19。
真的有办法在web.config文件中打开重写吗?
web.config文件
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<directoryBrowse enabled="false" />
<defaultDocument>
<files>
<clear />
<add value="home.php" />
<add value="index.html" />
</files>
</defaultDocument>
<rewrite>
<rules>
<rule name="rewrite php">
<!--Removes the .php extension for all pages.-->
<match url="(.*)" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" negate="true" pattern="(.*).php" />
</conditions>
<action type="Rewrite" url="{R:1}.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
http://stackoverflow.com/questions/18275740/have-page-come-up-without-the-aspx可能能够使用类似的东西去除.php – sealz