简体   繁体   English

301从一个目录重定向到另一个目录

[英]301 redirect from one directory to another

I am using the sitewide redirect solution provided by @Panama Jack Redirect entire website to https - non-www to www except subdomains 我正在使用@Panama Jack提供的整个站点范围重定向解决方案将整个网站重定向到 https- 非www到www的子网域除外

In addition, I also need a 301 re-direct from one directory to another ie 另外,我还需要从一个目录到另一个目录的301重定向,即

Redirect FROM 重定向自

 1. www.example.com/directory1/?q1=1234&page=1
 2. http://www.example.com/directory1/?q1=1234&page=1
 3. example.com/directory1/?q1=1234&page=1
 4. http://example.com/directory1/?q1=1234&page=1
 5. https://example.com/directory1/?q1=1234&page=1

To

 https://www.example.com/directory2/?q1=1234&page=1

Thanks in advance 提前致谢

You can add this new rule below your earlier 301 http->https rule: 您可以在以前的301 http->https规则下方添加此新规则:

RewriteRule ^directory1(/.*)?$ /directory2$1 [NC,L,NE,R=301]

QUERY_STRING will be automatically carried over to target URL. QUERY_STRING将自动结转到目标URL。

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

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