0

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} 

1 Answer 1

1
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}

Sign up to request clarification or add additional context in comments.

3 Comments

Incredible... that did the trick, so now everything will keep the url intact, just making sure everything is using https://. Can you explain what caused my configuration to redirect all none https to go to the home-page?
How can i make sure it doesn't go to www. but just domainname ?
just remove www. from the 3rd line RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.