htaccess重写的问题

时间:2015-09-14 01:17:42

标签: apache .htaccess mod-rewrite

我试图让几个目录永远是https而其他一切都是http

除了图像,css文件和js文件之外,它们应该在页面上。

所以我创建了这个htaccess重写:

RewriteEngine On
RewriteBase /


RewriteCond %{HTTP_HOST} ^www\.
RewriteRule ^(.*)$ https://server.com/$1 [R=301,L]




RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^login/(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]


RewriteRule \.(gif|jpe?g|png|css|js)$ - [NC,L]


RewriteCond %{HTTP:X-Forwarded-Proto} https
RewriteCond %{REQUEST_URI} !^login/(.*)$
RewriteRule .* http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

但是当我去/登录时出现错误

Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

需要改变哪些才能正常工作?

0 个答案:

没有答案