2011-05-11 98 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