【发布时间】:2017-05-24 07:10:37
【问题描述】:
我在 IIS mod_rewrite 模块中导入 .htaccess 文件时遇到问题。 出现 3 个错误。
.htaccess`
Options +FollowSymLinks -Indexes -MultiViews AddDefaultCharset UTF-8
<IfModule mod_rewrite.c>
RewriteEngine On
##If your NeoFrag directory is not at http root
##you need to replace "/" by the correct directory, for example "RewriteBase /neofrag/"
RewriteBase /
##Allow direct access to specific directories
#RewriteCond %{REQUEST_URI} ^/(dir1|dir2)/
#RewriteRule .* - [L,QSA]
RewriteCond %{REQUEST_URI} !^/backups/
##Allow direct access to specific files
#RewriteCond %{REQUEST_FILENAME} /file1\.php [OR]
#RewriteCond %{REQUEST_FILENAME} /file2\.php [OR]
RewriteCond %{REQUEST_FILENAME} \.(png|jpg|jpeg|gif|swf|eot|svg|ttf|woff|woff2|zip)$
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule .* - [L,QSA]
RewriteCond %{REQUEST_URI} \.html
RewriteRule (.*)\.html(.*) $1$2 [R=301,L]
RewriteRule .* index.php [E=REMOTE_USER:%{HTTP:Authorization},L,QSA]
</IfModule>
XML 视图
<rewrite>
<!--This directive was not converted because it is not supported by IIS: RewriteBase /.-->
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url=".*" ignoreCase="false" />
<conditions>
<add input="{URL}" pattern="^/(dir1|dir2)/" ignoreCase="false" />
</conditions>
<action type="None" />
</rule>
<!--This rule was not converted because only some of the conditions are using the OR flag.-->
<rule name="Imported Rule 3" stopProcessing="true">
<match url="(.*)\.html(.*)" ignoreCase="false" />
<conditions>
<add input="{URL}" pattern="\.html" ignoreCase="false" />
</conditions>
<action type="Redirect" redirectType="Permanent" url="{R:1}{R:2}" />
</rule>
<!--The rule cannot be converted into an equivalent IIS format because of unsupported flags: E-->
有人可以帮我解决这 3 行错误吗?
RewriteBase /RewriteRule .* - [L,QSA]RewriteRule .* index.php [E=REMOTE_USER:%{HTTP:Authorization},L,QSA]
【问题讨论】:
标签: .htaccess mod-rewrite iis