Dan
Dan

Reputation: 183

htaccess redirect all to https to http except for one folder

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://.

Upvotes: 3

Views: 6681

Answers (1)

Jon Lin
Jon Lin

Reputation: 143906

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.

Upvotes: 11

Related Questions