首页 文章

重定向301 .htaccess无效

提问于
浏览
-3

下面是我的htaccess和重定向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 回答

  • 1

    不需要 order 指令就把它取出来 . 你也无法匹配 Redirect 指令中的查询字符串使用 RewriteCondmod_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]
    

相关问题