htaccess将除一个文件夹外的所有文件重定向到https到http


htaccess redirect all to https to http except for one folder

我不知道为什么我找不到这个或做不到这个,但基本上我想做的就是将服务器上的任何页面重定向到https://,除非它在文件夹/fbt缩略图/中,因为facebook不允许缩略图为https://。

使用mod_rewrite,将其粘贴在.htaccess文件中的适当位置

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/fbthumbnails/
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI}  [R,L]

如果想要永久重定向,请将R更改为R=301