简体   繁体   English

.htaccess 301使用https Urls的重定向问题

[英].htaccess 301 redirect issue with https Urls

we want to redirect our .com domain name to .net domain, HTTP work for us, but when user use HTTPS path, they redirect to 404 page of .com domain. 我们想将.com域名重定向到.net域,HTTP对我们有用,但是当用户使用HTTPS路径时,他们将重定向到.com域的404页。 Please check our code and help me, how to redirect .com domain HTTP and HTTPS both user to some other .net domain. 请检查我们的代码,并帮助我如何将.com域HTTP和HTTPS都重定向到其他.net域。

RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.domain\.com$
RewriteRule ^(.*)$ "http\:\/\/domain\.net\/$1" [R=301,L]

Replace your rule by this rule: 用以下规则替换您的规则:

RewriteEngine on

RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$ [NC]
RewriteCond %{HTTPS}s on(s)|
RewriteRule ^ http%1://domain.net%{REQUEST_URI} [L,R=301,NE]

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

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