2017-05-23 84 views
1

我在我的IIS mod_rewrite模塊中導入.htaccess文件時出現問題。 出現3個錯誤。.htaccess IIS mod_rewrite

.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]

回答

0
RewriteBase/

你可以刪除這條線,其中包括對RewriteRule替代斜線前綴。即。更改以下行:

RewriteRule (.*)\.html(.*) $1$2 [R=301,L] 
RewriteRule .* index.php [E=REMOTE_USER:%{HTTP:Authorization},L,QSA] 

RewriteRule (.*)\.html(.*) /$1$2 [R=301,L] 
RewriteRule .* /index.php [E=REMOTE_USER:%{HTTP:Authorization},L,QSA] 

這條規則是不轉換,因爲只有一些條件使用OR標誌

轉換器似乎試圖轉換註釋掉的代碼?刪除所有開始的行#

RewriteRule .* /index.php [E=REMOTE_USER:%{HTTP:Authorization},L,QSA] 

E標誌設置的環境變量。我不會說IIS,但是您可以刪除上述指令中的E=REMOTE_USER:%{HTTP:Authorization},部分,而是使用mod_setenvif(將此轉換?)。例如,E標誌相當於以下內容:

SetEnvIf Authorization "(.*)" REMOTE_USER=$1 
+1

謝謝,它工作! – JakeMitchell

+0

不客氣!請將答案標記爲已接受,將其從未答覆的問題隊列中移除(左側的複選標記)。一旦你有15 +代表,你也可以upvote你覺得有用的答案。謝謝,非常感謝。 :) – MrWhite

+0

該網站的工作原理是頁面明智的,但現在我們無法在網站上登錄並從網站創建數據庫條目 – JakeMitchell