I have a folder with images, which should be accessed 开发者_如何学Pythononly using HTTPS. How to redirect all requests from HTTP to HTTPS?
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
This should do it.
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
精彩评论