开发者

Why vBulletin .htaccess file contains these repeated statements?

Please check the attached code.

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]
Rew开发者_开发百科riteRule ^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]


The first rule is to stop the rewriting process immediately if the requested URL can be mapped to an existing file, symbolic link or directory. The next five rules map the path prefixes to the associated files. But as the L flag is not set for these rules, the rewriting process will not stop but proceed and test the other rules until the next, repeated rule stops it like the first would do.


I only see this repeated once

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

RewriteRule ^.*$ - [NC,L]

you can remove the second occurrence.

The statements are there to resolve your SEO friendly URLs to PHP script files. For example this:

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

This will take urls like domain.com/threads/something and rewrite for process to showthread.php

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜