Apache 2.2的mod_rewriteredirect一些url到https和强制他人的http
我在共享主机上有我的页面。 一般来说,该网站可以使用http和https访问。 该页面投放广告,而且大部分广告都不能使用https,因此我只希望通过https访问pipe理部分。 我想要的是: http://myurl.com/auth -> https://myurl.com/auth http://myurl.com/admin -> https://myurl.com/admin https://myurl.com/allotherstuff -> http://myurl.com/allotherstuf 基本上所有的授权和承认请求都应该被redirect到使用ssl。 其他站点的请求应该从httpsredirect到http(如果使用https请求页面)。 我尝试了下面的.htaccess文件,这使得“auth”和“admin”无法访问(太多的redirect)。 <IfModule mod_rewrite.c> RewriteEngine On #Redirect other sites to http RewriteCond %{HTTPS} =on RewriteCond %{REQUEST_URI} !^/?auth.*$ RewriteCond %{REQUEST_URI} !^/?admin.*$ RewriteRule ^/?(.*) http://%{SERVER_NAME}/$1 [R,L] #Redirect auth and admin to https RewriteCond %{HTTPS} !=on RewriteRule ^/?auth/(.*) https://%{SERVER_NAME}/auth/$1 [R,L] RewriteCond %{HTTPS} !=on RewriteRule […]