简体   繁体   English

重定向到https / Apache

[英]Redirecting to https/Apache

How can I write a rewrite rule to redirect below rule to use HTTPS only without mentioning domain name. 如何编写重写规则以将以下规则重定向为仅使用HTTPS而不提及域名。 Below rule redirects to http home page. 以下规则将重定向到http主页。

RewriteRule ^/(.*) /webapp/wcs/stores/servlet/en/$1?x-orig-uri=$1 [PT,L,QSA]

Thanks 谢谢

When redirecting to https, you need to specify the full URL, including protocol and domain name. 重定向到https时,您需要指定完整的URL,包括协议和域名。 You could use a variable if you don't want to hardcode the name tho: 如果您不想对名称进行硬编码,则可以使用变量:

RewriteRule ^/(.*) https://%{HTTP_HOST}/webapp/wcs/stores/servlet/en/$1?x-orig-uri=$1 [PT,L,QSA]

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

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