![](/img/trans.png)
[英]Redirect entire website to https - non-www to www except subdomains
[英]Enable www + HTTPS on Entire Site
問題是這樣的,如果我輸入https://example.com並且不包含www,它將不會添加www。 如果輸入http://example.com ,它將單獨添加www和HTTPS。 請看這段代碼,任何幫助將不勝感激。 這就是我的.htaccess文件中的內容。
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule .* https://www.%{SERVER_NAME}%{REQUEST_URI} [R,L]
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|public|images|robots\.txt|css)
RewriteRule ^(.*)$ index.php/$1 [L]
嘗試:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{THE_REQUEST} /(acceptoffer|login|register|admin) [NC]
RewriteRule ^ https://www.domain.com/%1 [NC,L,R]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.