开发者

Force HTTPS request using .htaccess [duplicate]

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜