简体   繁体   English

htaccess永久重定向查询URL到一个位置

[英]Htaccess permanent redirect query urls to one location

I can't figure out how to redirect all query urls to another location. 我不知道如何将所有查询URL重定向到另一个位置。

Example: I want to redirect all urls that follow this pattern: 示例:我想重定向遵循此模式的所有网址:

https://www.test.com/index.php?option=com_sobipro&pid= [any numbers] &sid= [any numbers] &itemid=646 https://www.test.com/index.php?option=com_sobipro&pid= [任何数字] &sid = [任何数字] &itemid = 646

To new location: https://www.test.com/some/place/ 到新位置: https : //www.test.com/some/place/

I've googled for hours trying to learn and this is what I've come up with so far but I'm not sure this is right. 我已经在Google上搜索了数小时以尝试学习,这是我到目前为止提出的内容,但是我不确定这是正确的。

RewriteCond %{QUERY_STRING} option=com_sobipro&pid=(.*)&sid=(.*)&itemid=646$
RewriteRule ^$ /some/place/ [R=301,L]

How to check a requested (and dead) url for pattern and send it to another adress if conditions are met using htaccess? 如果使用htaccess满足条件,如何检查请求的(无效的)URL的模式并将其发送到另一个地址? Any guidence would be grately appreciated. 任何指导将不胜感激。

Place this rule as your top most rule: 将此规则作为最重要的规则:

RewriteEngine On

RewriteCond %{QUERY_STRING} option=com_sobipro&pid=[^&]+&sid=[^&]+&itemid=646
RewriteRule ^ /some/place/? [R=301,L]

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

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