2010-01-31 97 views
0

請檢查附件中的代碼。爲什麼vBulletin .htaccess文件包含這些重複的語句?

RewriteEngine on 

# If you are having problems or are using VirtualDocumentRoot, uncomment this line and set it to your vBulletin directory. 
# RewriteBase /forum/ 

RewriteCond %{REQUEST_FILENAME} -s [OR] 
RewriteCond %{REQUEST_FILENAME} -l [OR] 
RewriteCond %{REQUEST_FILENAME} -d 

RewriteRule ^.*$ - [NC,L] 

RewriteRule ^threads/.* showthread.php [QSA] 
RewriteRule ^forums/.* forumdisplay.php [QSA] 
RewriteRule ^members/.* member.php [QSA] 
RewriteRule ^blogs/.* blog.php [QSA] 
ReWriteRule ^entries/.* entry.php [QSA] 

RewriteCond %{REQUEST_FILENAME} -s [OR] 
RewriteCond %{REQUEST_FILENAME} -l [OR] 
RewriteCond %{REQUEST_FILENAME} -d 

RewriteRule ^.*$ - [NC,L] 

RewriteRule ^(?:(.*?)(?:/|$))(.*|$)$ $1.php?r=$2 [QSA] 

回答

0

的第一條規則是停止重寫的過程立即請求的URL可以映射到現有文件,符號鏈接或目錄。接下來的五條規則將路徑前綴映射到關聯的文件。但由於這些規則未設置標誌,所以重寫過程不會停止,而是繼續並測試其他規則,直到下一個重複規則像第一個規則那樣停止它爲止。

0

我只看到這個重複一次

RewriteCond %{REQUEST_FILENAME} -s [OR] 
RewriteCond %{REQUEST_FILENAME} -l [OR] 
RewriteCond %{REQUEST_FILENAME} -d 

RewriteRule ^.*$ - [NC,L] 

你可以刪除第二次出現。

聲明是爲了解決您的SEO友好的URL到PHP腳本文件。 例如這樣的:

RewriteRule ^threads/.* showthread.php [QSA] 

這將需要像domain.com/threads/something URL和重寫的過程showthread.php

+0

是的,我被問到爲什麼代碼重複? – Essam 2010-02-01 08:20:00