[英].htaccess specific code to redirect http traffic to https and redirect subdomain traffic to offsite domain
我最近用SSL建立了一個網站“saskatoonwashworld.com”。 我有兩個問題需要解決......
1)將所有http請求路由到https(我能夠通過在線找到的代碼輕松完成此操作)
2)我還有一個子域名“portal.saskatoonwashworld.com”,我想將其重定向到另一個站點托管的“ https://secure3.washcard.com/AP?CID=65e53149-59e9-4d67-a746-e475aa4bc7be ” 。 無論用戶是否在http://portal.###,https ://portal.###中輸入 ,或者只是沒有http(s)的網址,我都希望請求進入此處。
我無法弄清楚如何做到這一點,因為我不知道如何正確編碼條件和重寫。
我最初使用這個代碼在網上找到http到https重定向...但如果我正確理解它,它使用通配符來捕獲“www”。 因此會忽略/覆蓋我的“門戶網站”。 無論如何都是子域名。 但我可能是錯的。
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://saskatoonwashworld.com/$1 [R=301,L]
在.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.