当我使用它强制所有请求发送到https时,它可以正常工作(甚至重定向301):
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Redirect 301 /some.htm https://domain.nl/SEO-friendly-dir/
现在,当我尝试用两个额外的行排除两个目录时,它不再起作用(http突然又起作用了)。
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{REQUEST_URI} "/dir1/" [OR]
RewriteCond %{REQUEST_URI} "/dir2/"
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Redirect 301 /some.htm https://domain.nl/SEO-friendly-dir/
有人知道我在做什么错吗?
答案 0 :(得分:0)
如果您要查找网址,请尝试以下操作
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{REQUEST_URI} !^/dir1/
RewriteCond %{REQUEST_URI} !^/dir2/
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Redirect 301 /some.htm https://domain.nl/SEO-friendly-dir/