问题描述
我想使用带有 IIS 的 Windows Server 发布 Laravel 项目。
当我尝试使用来自 IIS 的 URL 重写器将 .htaccess 文件重写为 web.config 文件时,我收到以下错误:
No se puede convertir la regla en un formato de IIS equivalente porque contiene marcas no admitidas: E-->
<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>
我得到的 XML 文件如下:
<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>
如您所见,第一个规则是导致问题的规则。出于某种原因,它不允许在 RewriteRule 上使用字符“E”。
我对这个主题了解不多,但因此我无法应用该规则,唯一的方法是消除 .htaccess 上的第一条规则,但我确信它会导致问题我的应用在未来。
¿我该如何解决这个问题?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)