我正在尝试编写一个htaccess规则。我成功了。
RewriteCond %{REQUEST_URI} ^.*/RSS/CATALOG [OR,NC]
RewriteCond %{REQUEST_URI} ^.*/RSS/ORDER [OR,NC]
RewriteCond %{REQUEST_URI} ^.*RSS/CATALOG [NC]
RewriteRule ^(.*)$ http://%{HTTP_HOST}/ [R=302,L]
但在这里我想修改RewriteRule。在这里,我需要自动检测http / https,然后重定向。但没有成功。请帮忙。
答案 0 :(得分:0)
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} ^.*/RSS/CATALOG [OR,NC]
RewriteCond %{REQUEST_URI} ^.*/RSS/ORDER [OR,NC]
RewriteCond %{REQUEST_URI} ^.*RSS/CATALOG [NC]
RewriteRule ^(.*)$ http://%{HTTP_HOST}/ [R=302,L]
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} ^.*/RSS/CATALOG [OR,NC]
RewriteCond %{REQUEST_URI} ^.*/RSS/ORDER [OR,NC]
RewriteCond %{REQUEST_URI} ^.*RSS/CATALOG [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}/ [R=302,L]