我尝试了不同的链接,看它是否有效,但它似乎没有效果。我在Redhat EL6上配置了https。但是我希望从其中一个IP中获得例外。
除了一个IP 192.168.1.1之外,我想为所有人启用https。当我从IP 192.168.1.1访问URL时,它应该被重定向或重写为http://cab.abc.com而不是https://cab.abc.com
我的/etc/httpd/conf/httpd.conf的剪辑:
WHERE Cast(VisitDate as Date) BETWEEN CAST('01/01/2014' as Date) AND CAST('12/01/2014' as Date)
我尝试了多个选项并检查了rewrite.log文件:
<VirtualHost *:80>
DocumentRoot /opt/app/cr/public
ServerName cab.abc.com
RewriteEngine On
RewriteLog /var/tmp/rewrite.log
RewriteLogLevel 5
RewriteCond %{REMOTE_ADDR} ^192\.168\.1\.1
# RewriteRule .* http://cab.abc.com%{REQUEST_URI} [R]
# RewriteRule ^/(.*) http://cab.abc.com%{REQUEST_URI} [R]
RewriteRule .* http://cab.abc.com [L]
RewriteCond %{THE_REQUEST} ^(.*)
RewriteRule .* https://cab.abc.com%{REQUEST_URI} [R]
# ProxyPass / https://cab.abc.com/
# ProxyPassReverse / https://cab.abc.com/
</VirtualHost>
请求您的帮助从HTTP中排除IP地址。
答案 0 :(得分:0)
清除浏览器缓存后尝试以下规则:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{REMOTE_ADDR} !=192.168.1.1
RewriteRule ^ https://cab.abc.com%{REQUEST_URI} [R,L,NE]
RewriteCond %{REMOTE_ADDR} =192.168.1.1
RewriteRule ^ http://cab.abc.com%{REQUEST_URI} [R,L,NE]