2014-01-31 64 views
0

我將舊域(jeans-vintage.com)重定向到新域(destock-vintage.com)。這裏是我的.htaccess的一個片段:301將不在我的htaccess中的每個URL重定向到特定的URL

RewriteRule ^/$ http://www.destock-vintage.com/ [R=301,NE,NC,L] 
RewriteRule ^/jeans-vintage$ http://www.destock-vintage.com/ [R=301,NE,NC,L] 

# HOMMES 

RewriteRule ^70-polos$ http://www.destock-vintage.com/24-polos-vintage? [R=301,NE,NC,L] 
RewriteRule ^68-hommes$ http://www.destock-vintage.com/7-vetements-vintage-homme? [R=301,NE,NC,L] 
RewriteRule ^69-tous-les-$ http://www.destock-vintage.com/7-vetements-vintage-homme? [R=301,NE,NC,L] 
RewriteRule ^71-t$ http://www.destock-vintage.com/23-t-shirts-vintage? [R=301,NE,NC,L] 
RewriteRule ^72-c$ http://www.destock-vintage.com/25-chemises-vintage? [R=301,NE,NC,L] 
RewriteRule ^73-pulls$ http://www.destock-vintage.com/22-pulls-vintage? [R=301,NE,NC,L] 
RewriteRule ^74-bermudas-et-shorts$ http://www.destock-vintage.com/55-shorts-bermudas-vintage? [R=301,NE,NC,L] 
RewriteRule ^75-pantalo$ http://www.destock-vintage.com/26-pantalons-vintage? [R=301,NE,NC,L] 
RewriteRule ^76-jeans$ http://www.destock-vintage.com/9-jeans-vintage? [R=301,NE,NC,L] 
... 

我要實現的是重定向未明確在此htaccess的提及到新的域根destock-vintage.com每個URL是什麼。

例如,當我去jeans-vintage.com/70-polos時,它很適合destock-vintage.com/24-polos-vintage。

但是,如果我去這個網址http://www.jeans-vintage.com/panier?add&id_product=3460&token=43e9dbbf254328614bc7b9512e3948e6它停留在jeans-vintage.com和不重定向到destock復古...

我希望你明白:)提前

謝謝!

回答

1

最後你有這樣的規則與CATCH ALL規則。爲此規則將僅當URI不匹配任何的頂部規則:

# HOMMES 

RewriteRule ^70-polos$ http://www.destock-vintage.com/24-polos-vintage? [R=301,NE,NC,L] 
RewriteRule ^68-hommes$ http://www.destock-vintage.com/7-vetements-vintage-homme? [R=301,NE,NC,L] 
RewriteRule ^69-tous-les-$ http://www.destock-vintage.com/7-vetements-vintage-homme? [R=301,NE,NC,L] 
RewriteRule ^71-t$ http://www.destock-vintage.com/23-t-shirts-vintage? [R=301,NE,NC,L] 
RewriteRule ^72-c$ http://www.destock-vintage.com/25-chemises-vintage? [R=301,NE,NC,L] 
RewriteRule ^73-pulls$ http://www.destock-vintage.com/22-pulls-vintage? [R=301,NE,NC,L] 
RewriteRule ^74-bermudas-et-shorts$ http://www.destock-vintage.com/55-shorts-bermudas-vintage? [R=301,NE,NC,L] 
RewriteRule ^75-pantalo$ http://www.destock-vintage.com/26-pantalons-vintage? [R=301,NE,NC,L] 
RewriteRule ^76-jeans$ http://www.destock-vintage.com/9-jeans-vintage? [R=301,NE,NC,L] 

# CATCH ALL rule 
RewriteRule^http://www.destock-vintage.com/ [R=301,L] 
1

如果我理解正確的話,你就必須把最後一條規則捕捉所有URI在現有的結束規則:

重寫規則^ http://www.destock-vintage.com/ [R = 301,NE,NC,L]

因爲每個其他規則具有 「LAST」 選項[L](因此,如果任何規則這不會與其他規則競爭在「全部捕捉」規則之前匹配,之後不會執行任何規則)。

Regards