.htaccess 如何配置https重写的htaccess?

.htaccess 如何配置https重写的htaccess?,.htaccess,https,rewrite,.htaccess,Https,Rewrite,我在一些子目录(/login,/administration)中使用https://作为示例,但另一方面,我必须确保所有其他页面都重定向到http:// 现在,我通过链接将用户发送到https://但是当他们离开登录区域时,他们保持https://模式 我现在在standardconfiguration中使用RewriteCond: SetEnv APPLICATION_ENVIRONMENT show RewriteEngine On RewriteBase / RewriteCond %{

我在一些子目录(/login,/administration)中使用https://作为示例,但另一方面,我必须确保所有其他页面都重定向到http://

现在,我通过链接将用户发送到https://但是当他们离开登录区域时,他们保持https://模式

我现在在standardconfiguration中使用RewriteCond:

SetEnv APPLICATION_ENVIRONMENT show
RewriteEngine On

RewriteBase /
RewriteCond %{HTTP_HOST} !^www.xxxseitexxx.de$ [NC]
RewriteRule ^(.*)$ http://www.xxxseitexxx.de/$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d

RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ /index.php [NC,L]

RewriteRule !\.(js|ico|gif|jpg|jpeg|png|css|inc|pdf|csv|zip|rm|mp3|swf)$ index.php

提前谢谢

您可以在其他规则的基础上使用此规则:

# force HTTP for not login or admininstration
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !/admininstration|login/ [NC]
RewriteRule ^ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=302]

# force HTTPS for login or admininstration
RewriteCond %{HTTPS} off
RewriteRule ^(admininstration|login)/ https://%{HTTP_HOST}%{REQUEST_URI} [L,NC,R=302]

谢谢,但是对不起,它不起作用。http部分运行良好,如果您现在使用https调用页面,您将获得http版本。但是https部分不起作用:登录进入http页面(即使我调用https),管理层将进入startpage。我应该提到的是,我们调用/administration/start,不仅仅是/administration(但它应该适用于/administration下的任何内容),而且整个过程都是由框架生成的虚拟路径。如果您使用的是框架,那么可能已经有一些规则。你能在你的问题中发布你当前的.htaccess吗?你在上面看到的是我的完整htaccess。可能重写规则^(.*)时发生冲突$