Mod重写https到http但不是/ administrator /

时间:2014-08-19 10:55:58

标签: .htaccess mod-rewrite joomla

我在我有https的域上安装了joomla。 现在我希望www.domain.com/administrator使用https,但所有的网址都应该使用http而不是https。

我有这个时刻:

RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

这会将所有https重定向到http。有用。 但我怎么能排除

  

www.domain.com/administrator

URL? 谢谢你的帮助!

2 个答案:

答案 0 :(得分:1)

如果您只希望管理员网址使用https://,那么这是默认的Joomla参数。

在Joomla后端,请转到:

全局配置>> 服务器

并将强制SSL 设置为仅限管理员

答案 1 :(得分:1)

如果您想通过htaccess实现这一目标,可以将此代码放入其中

RewriteEngine On

RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} ^/administrator
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]

RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !^/administrator
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [R=301,L]