0

我正在使用以下 httaccess 内容,强制重写 url 以使用 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.

我使用了许多其他解决方案,但总是得到这个......

4

1 回答 1

1

试试下面的 .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]
于 2012-10-27T16:54:09.927 回答