简体   繁体   中英

Redirect http to correct https

I have a question. My Joomla installation makes sure that all transfers are through https istead of http. To rewrite all http to https i use the rewrite conditions below in .htaccess. This works great, however when i go to a page, for example: http://domainname.com/page it redirects to https://domainname.com/index.php . What i want it to do is redirecting http://domainname.com/page to https://domainname.com/page . Same goes for 'www'. Can you please help me with the correct redirects?

RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

this should work forcing all to https://www .{HOST}

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