htaccess url rewrite转到第一个链接

时间:2015-05-07 13:11:54

标签: php .htaccess mod-rewrite url-rewriting

我的htaccess文件有三个网址的重写规则。但是所有三个网址都只到第一个网址。以下是htaccess代码

RewriteEngine on
RewriteBase /tamiloosai/


RewriteCond %{THE_REQUEST} /page1\.php\?cat=([^\s&]+) [NC]
RewriteRule ^ %1? [R=302,NE,L]

RewriteCond %{THE_REQUEST} /page2\.php\?name=([^\s&]+) [NC]
RewriteRule ^ %1? [R=302,NE,L]

RewriteCond %{THE_REQUEST} /page3\.php\?id=([^\s&]+) [NC]
RewriteRule ^ %1? [R=302,NE,L]


RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]*)/?$ page1.php?cat=$1 [L,NE,QSA,NC]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]*)/?$ page2.php?name=$1 [L,NE,QSA,NC]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]*)/?$ page3.php?id=$1 [L,NE,QSA,NC]

同时转到page1.php它转到page1.php和page2.php一样,page3.php也转到page1.php,但是page2.php必须转到page2.php和page3.php必须转到page3.php如何解决这个问题?

0 个答案:

没有答案