0

请检查随附的代码。

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

2 回答 2

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

于 2010-01-31T20:49:42.643 回答
0

第一条规则是如果请求的 URL 可以映射到现有文件、符号链接或目录,则立即停止重写过程。接下来的五个规则将路径前缀映射到相关文件。但是由于没有为这些规则设置L标志,重写过程不会停止,而是继续并测试其他规则,直到下一个重复规则停止它,就像第一个会做的那样。

于 2010-01-31T20:50:37.960 回答