RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^\/]+)/([^\/]+)/([^\/]+)(\/|)$ index.php?tab1=$1&tab2=$2&tab3=$3 [QSA]
RewriteRule ^([^\/]+)/([^\/]+)(\/|)$ index.php?tab1=$1&tab2=$2 [QSA]
RewriteRule ^([^\/]+)(\/|)$ index.php?tab1=$1 [QSA]
当我去ajax.php'它充当' index.php?tab1 = ajax.php& t = post& a = new'。为什么?我该如何解决这个问题?我希望ajax.php是一个单独的文件。
答案 0 :(得分:0)
这样做:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/?$ index.php?tab1=$1&tab2=$2&tab3=$3 [QSA,L]
RewriteRule ^([^/]+)/([^/]+)/?$ index.php?tab1=$1&tab2=$2 [QSA,L]
RewriteRule ^([^/]+)/?$ index.php?tab1=$1 [QSA,L]
请记住,RewriteCond
仅适用于大多数相邻的RewriteRule
。