I have a folder with images, which should be accessed only using HTTPS. How to redirect all requests from HTTP to HTTPS?
Asked
Active
Viewed 1,772 times
2 Answers
6
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
This should do it.

Utku Zihnioglu
- 4,714
- 3
- 38
- 50
1
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]
Search keyword for next time you want to know how to redirect something: mod_rewrite

Dan Grossman
- 51,866
- 10
- 112
- 101