重定向301 .htaccess无效

时间:2014-10-26 08:54:19

标签: php .htaccess redirect

以下是我的htaccess,Redirect 301不起作用。任何想法?


    order allow,deny
    allow from all
    Options -Indexes
    Options +FollowSymLinks 
    RewriteEngine On 
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule . index.php [L]
    Redirect 301 /index.php?id=4 site.com/newdirectory/

1 个答案:

答案 0 :(得分:1)

只需将它取出就不需要

order指令。此外,您无法匹配Redirect RewriteCond mod_rewrite指令中的查询字符串,而不是这样:

RewriteEngine On 
RewriteBase /

RewriteCond %{QUERY_STRING} ^id=4$ [NC]
RewriteRule ^index\.php$ /newdirectory/? [L,NC,R=301]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . index.php [L]