我正在为重定向2个或更多文件夹寻找良好的正则表达式
我有很多网址,例如:
https://www.my-domaine.com/studiant/test-num/42
但是我想将两个“最终”网址重定向到无https
https://www.my-domaine.com/studiant/helper-helper/theme/math/ressrouce/20
或
https://www.my-domaine.com/studiant/test-num/42
我已经尝试了几种方法,正则表达式,但是100%都无效。
RewriteCond %{THE_REQUEST} \s/+studiant/helper-helper/theme/(.*)/ressource/(.*)[/?\s] [NC,OR]
RewriteCond %{THE_REQUEST} /studiant/test-num/[0-9]+ [NC]
或
RewriteEngine on
RewriteCond %{HTTPS} !on
RewriteRule ^((?!test-num.*|ressource).*)$ https://%{HTTP_HOST}%REQUEST_URI} [NE,L,R]
RewriteCond %{HTTPS} on
RewriteRule ^test-num.*|ressource*)$ http://%{HTTP_HOST}%{REQUEST_URI} [NE,L,R]
我尝试了这个: How to redirect site to https and http using htaccess for specific file and folder