[英].htaccess specific code to redirect http traffic to https and redirect subdomain traffic to offsite domain
I have recently set up a site "saskatoonwashworld.com" with SSL. 我最近用SSL建立了一个网站“saskatoonwashworld.com”。 I have two issues that I need to resolve...
我有两个问题需要解决......
1) Route all http requests to https (I was able to do this easy enough with code found online) 1)将所有http请求路由到https(我能够通过在线找到的代码轻松完成此操作)
2) I also have a subdomain "portal.saskatoonwashworld.com" which I want redirected to " https://secure3.washcard.com/AP?CID=65e53149-59e9-4d67-a746-e475aa4bc7be " which is hosted by another site. 2)我还有一个子域名“portal.saskatoonwashworld.com”,我想将其重定向到另一个站点托管的“ https://secure3.washcard.com/AP?CID=65e53149-59e9-4d67-a746-e475aa4bc7be ” 。 I want the requests to go here whether or not the user types in http://portal.### , https://portal.### , or just the url without the http(s).
无论用户是否在http://portal.###,https ://portal.###中输入 ,或者只是没有http(s)的网址,我都希望请求进入此处。
I cannot figure out how to do it as I don't know how to properly code the conditions and rewrites. 我无法弄清楚如何做到这一点,因为我不知道如何正确编码条件和重写。
I was originally using this code found online for the http to https redirect...but if I'm understanding it correctly, it is using a wildcard to catch "www." 我最初使用这个代码在网上找到http到https重定向...但如果我正确理解它,它使用通配符来捕获“www”。 and so would ignore/override my "portal."
因此会忽略/覆盖我的“门户网站”。 subdomain anyways.
无论如何都是子域名。 But I could be wrong.
但我可能是错的。
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://saskatoonwashworld.com/$1 [R=301,L]
Try this rewrites in .htaccess file: 在.htaccess文件中尝试重写:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?portal\.saskatoonwashworld\.com [NC]
RewriteRule (.*) https://secure3.washcard.com/AP?CID=65e53149-59e9-4d67-a746-e475aa4bc7be [R=301,L]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://saskatoonwashworld.com/$1 [L,R=301]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.