htaccess redirect all to https to http except for one folder

…衆ロ難τιáo~ 提交于 2019-12-19 04:08:26

问题


I don't know why I can't find this or do this but basically all I want to do is redirect any page on my server to https:// unless it is in the folder /fbthumbnails/ because facebook doesn't allow thumbnails to be https://.


回答1:


Using mod_rewrite, stick this in an appropriate place in your .htaccess file

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

Change the R to R=301 if you want a permanent redirect.



来源:https://stackoverflow.com/questions/8753987/htaccess-redirect-all-to-https-to-http-except-for-one-folder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!