我的重定向规则不起作用

时间:2014-01-02 16:22:53

标签: apache .htaccess

我想要我的网址

http://gpuzzles.com/quiz/small-ridldes/

重定向到

http://gpuzzles.com/quiz/small-riddles/

但它不起作用

我的.htacess文件位于测验文件夹中

RewriteEngine On
RewriteBase /quiz/
Redirect 301 /quiz/small-ridldes/ /quiz/small-riddles/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)?$ index.php?url=$1&page=$2 [L,QSA]

我想要什么

quiz/small-ridldes/ redirects to
quiz/small-riddles/ redirects to  // ----- not working 
index.php         // ----working

1 个答案:

答案 0 :(得分:2)

您不希望将mod_alias指令(Redirect)与mod_rewrite指令(RewriteRule)混合使用。尝试:

RewriteEngine On
RewriteBase /quiz/
RewriteRule ^small-ridldes/$ /quiz/small-riddles/ [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)?$ index.php?url=$1&page=$2 [L,QSA]