Laravel 使用IIS URL重写器重写.htaccess到web.config
我想使用Windows Server和IIS发布Laravel项目 当我尝试使用IIS中的URL重写器将.htaccess文件重写为web.config文件时,出现以下错误:Laravel 使用IIS URL重写器重写.htaccess到web.config,laravel,.htaccess,iis,mod-rewrite,web-config,Laravel,.htaccess,Iis,Mod Rewrite,Web Config,我想使用Windows Server和IIS发布Laravel项目 当我尝试使用IIS中的URL重写器将.htaccess文件重写为web.config文件时,出现以下错误: 没有转换为IIS等效格式的规则,没有许可证:E--> .htaccess文件具有以下内容: <IfModule mod_rewrite.c> <IfModule mod_negotiation.c> Options -MultiViews -Indexes </
没有转换为IIS等效格式的规则,没有许可证:E-->
.htaccess文件具有以下内容:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
<rewrite>
<rules>
<!--No se puede convertir la regla en un formato de IIS equivalente porque contiene marcas no admitidas: E-->
<rule name="Regla 2 importada" stopProcessing="true">
<match url="^" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
<add input="{URL}" pattern="(.+)/$" ignoreCase="false" />
</conditions>
<action type="Redirect" redirectType="Permanent" url="{C:1}" />
</rule>
<rule name="Regla 3 importada" stopProcessing="true">
<match url="^" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
选项-多视图-索引
重新启动发动机
#句柄授权头
RewriteCond%{HTTP:Authorization}。
重写规则。*-[E=HTTP\U授权:%{HTTP:AUTHORIZATION}]
#如果不是文件夹,则重定向尾部斜杠。。。
重写cond%{REQUEST_FILENAME}-D
重写cond%{REQUEST_URI}(+)/$
重写规则^1[L,R=301]
#向前端控制器发送请求。。。
重写cond%{REQUEST_FILENAME}-D
重写cond%{REQUEST_FILENAME}-F
重写规则^index.php[L]
我得到的XML文件如下所示:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
<rewrite>
<rules>
<!--No se puede convertir la regla en un formato de IIS equivalente porque contiene marcas no admitidas: E-->
<rule name="Regla 2 importada" stopProcessing="true">
<match url="^" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
<add input="{URL}" pattern="(.+)/$" ignoreCase="false" />
</conditions>
<action type="Redirect" redirectType="Permanent" url="{C:1}" />
</rule>
<rule name="Regla 3 importada" stopProcessing="true">
<match url="^" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
如您所见,第一条规则是导致问题的规则。出于某种原因,它不允许在重写规则中使用字符“E”
我对这个主题不太了解,但由于这个原因,我无法应用该规则,唯一的方法是删除.htaccess上的第一条规则,但我确信这将在将来的应用程序上造成问题
?如何解决此问题?此链接可能有帮助: