0

我使用 .htaccess 将以下条目作为固定文件处理(例如)

RewriteEngine On    
RewriteRule ^redir$ redir_base64.php
RewriteRule ^confirm$ confirm.php
RewriteRule ^migrate$ migrate.php
RewriteRule ^import_conn$ import_conn.php
RewriteRule ^callback_ot$ callback_ot.php
RewriteRule ^callback_yh$ callback_yh.php
RewriteRule ^callback_gp$ callback_gp.php
RewriteRule ^callback_lk$ callback_lk.php
RewriteRule ^results/map$ index.php
RewriteRule ^results$ index.php
RewriteRule ^robots\.txt$ robots.php
RewriteRule ^sitemap\.xml$ sitemap.php
RewriteRule ^removeml$ removeml.php
RewriteRule ^rss$ rss_gen.php
RewriteRule ^cpt\.jpg$ c/captcha/captcha.php
RewriteRule ^cptfrm\.jpg$ c/captcha/captcha.php?width=120&height=60&characters=4
RewriteRule ^cptfrm160\.jpg$ c/captcha/captcha.php?width=100&height=60&characters=3
RewriteRule ^login/lk$ login_conn.php?op=lk
RewriteRule ^t$ c/thumb/phpThumb.php
RewriteRule ^spce$ spce.php
RewriteRule ^orplkd$ order_publisher.php
RewriteRule ^ord_ren$ order_reactivate.php
RewriteRule ^logout$ logout.php

此条目工作正常!但是我需要访问 /000/000 并且我看到与行的冲突指示如下。

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^([\d\w\-\.]+)/([\d]+)$ index.php [QSA,L]
RewriteRule ^([\d\w\-\.]+)$ index.php [QSA,L]

我尝试使用该行访问我的站点,但我无法仅识别最后一行,因为使用站点上的 ALL 访问。

我希望如此理解我的帮助。

谢谢!

4

1 回答 1

1

您需要重复这两个条件。重写条件适用于紧随其后的条件。

RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([\d\w\-\.]+)/([\d]+)$ index.php [QSA,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([\d\w\-\.]+)$ index.php [QSA,L]
于 2013-10-01T01:42:31.643 回答