301重定向从一个目录到另一个 [英] 301 redirect from one directory to another

查看:121
本文介绍了301重定向从一个目录到另一个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我利用@Panama杰克提供的网站范围重定向解决方案       <一href="http://stackoverflow.com/questions/24463693/redirect-entire-website-to-https-non-www-to-www-except-subdomains">Redirect整个网站到HTTPS - 非www到www除了子域

I am using the sitewide redirect solution provided by @Panama Jack Redirect entire website to https - non-www to www except subdomains

另外,我还需要一个301再直接从一个目录到另一个即

In addition, I also need a 301 re-direct from one directory to another i.e.

重定向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

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

在此先感谢

推荐答案

您可以添加新的规则下面你早先的301​​ 基于HTTP&GT; HTTPS 规则:

You can add this new rule below your earlier 301 http->https rule:

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

QUERY_STRING 将自动结转到目标URL。

QUERY_STRING will be automatically carried over to target URL.

这篇关于301重定向从一个目录到另一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆