简体   繁体   English

301重定向传递参数?

[英]301 Redirect passing parameters?

I have an old prestashop website http://www.jeans-vintage.com/ (in french). 我有一个旧的prestashop网站http://www.jeans-vintage.com/ (法语)。 I want to do some 301 redirects to the new domain which is http://www.destock-vintage.com/ . 我想将301重定向到http://www.destock-vintage.com/的新域。

So I modified Jeans-Vintage htaccess : 所以我修改了Jeans-Vintage htaccess

For example for the Men Polos category : 例如,对于“男性polos”类别:

RedirectPermanent /70-polos http://www.destock-vintage.com/24-polos-vintage

The redirection is working you can test it here : http://www.jeans-vintage.com/70-polos 重定向有效,您可以在此处进行测试: http://www.jeans-vintage.com/70-polos : http://www.jeans-vintage.com/70-polos

But when the new page loads here is the URL : http://www.destock-vintage.com/24-polos-vintage?id_category=70 但是,在加载新页面时,URL是: http://www.destock-vintage.com/24-polos-vintage?id_category=70 : http://www.destock-vintage.com/24-polos-vintage?id_category=70 id_category= http://www.destock-vintage.com/24-polos-vintage?id_category=70

Why do I have that ?id_category=70 ?? 为什么我有那个?id_category=70

It's doing the exact same thing for every 301 redirect I'm trying... 我尝试的每个301重定向都执行完全相同的操作...

I tried adding a "?" 我尝试添加“?” at the end of the redirect but this still doesn't work and shows : 在重定向结束时,但这仍然无效,并显示:

http://www.destock-vintage.com/24-polos-vintage?

Any help would be appreciated ! 任何帮助,将不胜感激 !

Thanks guys :) 多谢你们 :)

Try this on Jeans-Vintage htaccess: Jeans-Vintage htaccess上尝试一下:

RewriteEngine On

RewriteCond %{HTTP_HOST}  ^www\.jeans-vintage\.com$ [NC]
RewriteCond %{QUERY_STRING}  ^$
RewriteRule ^70-polos$ http://www.destock-vintage.com/24-polos-vintage? [R=301,NE,NC,L]

You need to use mod_rewrite rules to strip off existing query string in Jeans-Vintage htaccess 您需要使用mod_rewrite规则剥离Jeans-Vintage htaccess现有查询字符串

RewriteEngine On
RewriteRule ^70-polos/?$ http://www.destock-vintage.com/24-polos-vintage? [R=301,NC,L]

? in the end strips off any existing query string. 最后删除所有现有的查询字符串。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM