问题描述
Laravel4 框架带有一个默认的 .htaccess 规则来创建漂亮的 url.
Laravel4 framework comes with a default .htaccess rule for create pretty urls.
规则是这样的.
<IfModule mod_rewrite.c> Options -MultiViews RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] </IfModule>
问题:哪个在 IIS 中等效??
Question: Which is the equivalent in IIS ??
推荐答案
您可以使用 导入Apache 规则功能 将Apache 规则转换为IIS.
You can use the import Apache rules feature to convert Apache rule to IIS.
在你的情况下,它会变成:
In your case, it will go as:
或者在 web.config 文件中:
<rule name="Imported Rule 1" stopProcessing="true"> <match url="^" ignoreCase="false" /> <conditions logicalGrouping="MatchAll"> <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" /> </conditions> <action type="Rewrite" url="index.php" /> </rule>