我有一个网站,我试图在HTTPS中运行,除了某些目录。我在.htaccess中使用的命令会自动将站点放入HTTPS,但我的/search和/search-results不会重定向到HTTPS。
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTPS} on
RewriteRule ^search$ http://www.example.com/search [R=301,L]
RewriteRule ^search-results$ http://www.example.com/search-results [R=301,L]有人能告诉我这个的正确语法吗?
发布于 2015-03-05 03:54:56
试着这样做。
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/(search|search-results)$ [NC]
RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} ^/(search|search-results)$ [NC]
RewriteRule ^ http://www.example.com/%1 [R=301,L]https://stackoverflow.com/questions/28863492
复制相似问题