簡體   English   中英

htaccess重定向到https

[英]Htaccess redirection to https

我正在使用以下httaccess內容,以強制重寫網址以使用https而不是http

RewriteEngine on
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.mydomain.com/$1 [L]

但是它總是在變,頁面無法正確重定向

Firefox has detected that the server is redirecting the request for this address
in a way that will never complete.     
This problem can sometimes be caused by disabling or refusing to accept
cookies.

我使用了許多其他解決方案,但總是得到這個...

嘗試下面的.htaccess代碼

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

#uncomment the below two line if you need to append www
# RewriteCond %{HTTP_HOST} !^www\. [NC]
# RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM