开发者

Force HTTPS request using .htaccess [duplicate]

开发者 https://www.devze.com 2023-01-30 08:06 出处:网络
This question already has answers here: How to redirect all HTTP requests to HTTPS using .htaccess rules?
This question already has answers here: How to redirect all HTTP requests to HTTPS using .htaccess rules? (30 answers) Closed 9 years ago.

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

0

精彩评论

暂无评论...
验证码 换一张
取 消