Redirection 301 with htaccess with url variables

跟風遠走 提交于 2019-12-13 06:22:26

问题


I've searched answers on the forum but didn't worked for me.

I have rebuild an website using Wordpress and want to keep old urls.

I have old URLs like : index.php?option=com_content&view=article&id=51&Itemid=67&lang=fr

that i want to move permanantly to url like : /produits-et-services/conseil-et-accompagnement/

Redirect 301 didn't worked because of vars in URL.. and i've try this :

RewriteCond %{QUERY_STRING} ^option=com_content&view=article&id=51&Itemid=67&lang=fr$ [NC]
RewriteRule ^index.php$ http://solunea.fr/produits-et-services/conseil-et-accompagnement/ [L,R=301]

On my wordpress .htaccess but didn't worked either.

Can someone help me please ??


回答1:


Make sure this rule:

RewriteCond %{QUERY_STRING} ^option=com_content&view=article&id=51&Itemid=67&lang=fr$ [NC] 
RewriteRule ^(index\.php)?$ /produits-et-services/conseil-et-accompagnement/ [L,R=301,NC]

is placed right on top before any other existing rewrite rule

and test in a different browser to avoid 301 caching issues.



来源:https://stackoverflow.com/questions/19454745/redirection-301-with-htaccess-with-url-variables

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!