简体   繁体   中英

How to redirect HTTP requests to HTTPS

I want to redirect my all urls from http to https I am able to do so with given code.

RewriteCond %{HTTPS} !=on
RewriteRule ^.*$ "https\:\/\/www\.domain\.com\/$1" [L,R=301]

But issue is that when my url is like http://domain.com/admin/users/login then it redirects to https://www.domain.com/users/login how can I redirect this on https://www.domain.com/admin/users/login

Try:

RewriteCond %{HTTPS} !=on
RewriteRule ^ https://www.domain.com%{REQUEST_URI} [L,R=301]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM