您的位置:首页 > 编程语言 > PHP开发

php-url-rewriting-with-htaccess-and-microsoft-iis-url-rewriting

2015-08-17 16:40 751 查看
If you use IIS 7 then you can use IIS URL Rewrite Module, that has an "Import
Rules" feature that can be used to translate mod_rewrite rules to IIS URL rewrite format. These particular rewrite rules will not translate because the RewriteCond uses the "-s" and "-l" flags which check if the requested URL corresponds to a non-zero
size file or to a symbolic link on a file system. If your application does not use any symbolic links then you can safely replace these conditions with:
RewriteCond %{REQUEST_FILENAME} -f [OR]


and then convert the rules by using IIS URL Rewrite UI. That will result in these rules:
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^.*$" />
<conditions logicalGrouping="MatchAny">
<add input="{REQUEST_FILENAME}" matchType="IsFile"  />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory"  />
</conditions>
<action type="None" />
</rule>
<rule name="Imported Rule 2" stopProcessing="true">
<match url="^.*$" />
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: