我有以下HTTP地址:如何將HTTP重新連接到HTTPS與子域?
http://www.example.com/
但我HTTPS地址都有一個子也沒有WWW,像這樣:
https://secure.example.com/
我嘗試以下規則:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://secure.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
差我來:
https://secure.www.example.com/
如何強制HTTPS在這種情況呢?因爲我需要刪除www。
編輯:我的上方都有這些規則 '花哨的網址' 爲我使用WordPress作爲CMS:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
謝謝,但不幸的是,人們不知道該子域,因爲它只用於與HTTPS。 –
你想將主站點重定向到子域嗎? – starkeen
是的。我希望將主要網站'http:// www.'重定向到'https:// secure.',同時保持WordPress規則適用於花哨的URL(請參閱OP中的編輯)。在此先感謝:) –