2011-05-11 52 views
0

试图让一个简单的301使用此代码htaccess的重定向: 重定向301/CAT /散热器笼/产品/散热器支持笼/ http://www.mysite.com/product/radiator-cages/custom-radiator-support-cage/重定向301不按我预期的方式工作!

结果送我去 http://www.mysite.com/product/radiator-cages/custom-radiator-support-cage/?page=cat/radiator-cages/product/radiator-support-cage

任何想法我做错了什么? 在此先感谢您的帮助。

--Update--

RewriteCond %{HTTP_HOST} ^mysite.com [NC] 
RewriteRule ^(.*)$ http://www.mysite.com/$1 [L,R=301] 
RewriteRule ^product/(.*)/(.*)/$ /index.php?page=product&parent_url=$1&product=$2 [L,NC] 

Redirect 301 /cat/radiator-cages/product/radiator-support-cage/ http://www.mysite.com/product/radiator-cages/custom-radiator-support-cage/ 
+0

你有可能被生产这种错误的.htaccess文件的其他规则?比如RewriteRule – 2011-05-11 15:58:15

+0

@Ryan Matthews我用我的htaccess中的其他规则更新了原始邮件 – Dave 2011-05-11 16:37:55

回答

1

我建议不妨先使用301重定向声明。

你的htaccess应该再看看财产以后这样

Redirect 301 /cat/radiator-cages/product/radiator-support-cage/ http://www.mysite.com/product/radiator-cages/custom-radiator-support-cage/ 
    RewriteEngine on 
    RewriteCond %{HTTP_HOST} ^mysite.com [NC] 
    RewriteRule ^(.*)$ http://www.mysite.com/$1 [L,R=301] 
    RewriteRule ^product/(.*)/(.*)/$ /index.php?page=product&parent_url=$1&product=$2 [L,NC] 

编辑:

RewriteEngine on 
    RewriteCond %{HTTP_HOST} ^mysite.com [NC] 
    RewriteRule ^(.*)$ http://www.mysite.com/$1 [L,R=301] 
    RewriteRule ^/cat/radiator-cages/product/radiator-support-cage/$ http://www.mysite.com/product/radiator-cages/custom-radiator-support-cage/ [R=301,L] 
    RewriteRule ^product/(.*)/(.*)/$ /index.php?page=product&parent_url=$1&product=$2 [L,NC] 

http://www.gerronmulder.com/common-seo-rewrite-rules-for-apache-using-htaccess/

+0

另外为了测试重定向是否正在工作,请删除重写规则并查看它是否有效。不要忘记清除缓存(Firefox有这个问题,有时我会注意到) – 2011-05-11 16:44:37

+0

@Ryan Matthews Nope。仍然是相同的结果.... – Dave 2011-05-11 16:48:16

+0

@Ryan马修斯,其实,我关掉了重写规则,它确实有效。那么现在我该怎么做? – Dave 2011-05-11 16:50:17