简体   繁体   English

apache2 .htaccess中的URL重定向

[英]URL redirect in apache2 .htaccess

how can i redirect redirect url from 我如何重定向从

http://www.mydomain.com to https://mydomain.com http://www.mydomain.comhttps://mydomain.com

and

https://www.mydomain.com to https://mydomain.com https://www.mydomain.comhttps://mydomain.com

or all subdomain with our without https except status.mydomain.com to redirect to https://mydomain.com ? 还是所有没有https子域(除了status.mydomain.com之外) status.mydomain.com重定向到https://mydomain.com

Example: hello.mydomain.com and https://hello.mydomain.com to https://mydomain.com ? 例如: hello.mydomain.comhttps://hello.mydomain.comhttps://mydomain.com吗?

Maybe this is help you 也许这对你有帮助

Redirect 302 http://www.mydomain.com https://mydomain.com 重定向302 http://www.mydomain.com https://mydomain.com

put this code in your DOCUMENT_ROOT/.htaccess file: 将此代码放在您的DOCUMENT_ROOT/.htaccess文件中:

RewriteEngine On

RewriteCond %{HTTP_HOST} !^status\. [NC]
RewriteCond %{HTTP_HOST} ^[^.]+\.mydomain\.com$ [NC]
RewriteRule ^ https://mydomain.com%{REQUEST_URI} [NE,R=301,L]

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

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