.htaccess重定向链接组合

时间:2019-02-21 18:50:23

标签: .htaccess redirect hyperlink combinations

我的htaccess文件中包含以下代码:

Redirect /produkte/category/subcategory/ https://www.newsite.com/category/subcategory
Redirect /produkte/category/subcategory/product/ https://www.newsite.com/category/product

第一行正常,但第二行重定向到行组合:

https://www.newsite.com/category/subcategoryproduct

这个示例是简单的示例之一,但是有一些更复杂的链接,如何使每行与前面的行分开考虑?

1 个答案:

答案 0 :(得分:0)

谢谢大家, 解决方法:

RewriteCond %{QUERY_STRING}
RewriteRule ^/produkte/category/subcategory/$ https://www.newsite.com/category/subcategory? [R=301,NE,NC,L]
RewriteCond %{QUERY_STRING}
RewriteRule ^/produkte/category/subcategory/product/$ https://www.newsite.com/category/product? [R=301,NE,NC,L]