2010-01-31 99 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