I'm trying to redirect http to https on all pages via an htaccess in the main root of the website (shared hosting). I can't understand why this isn't working? This is the entire content of the htaccess file. Whilst there seem to be similar questions already asked on Stackoverflow, I can't find any solutions that would seem to be of help.
There is one folder/directory on the website that requires SSL so I can't disable SSL on the whole website. That folder has its own htaccess file.
The second chunk of code is very standard as it's a Joomla website. I can't imagine the issue would be in there?
RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
##### Joomla! core SEF Section -- BEGIN
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_URI} !^/index\.php
RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|raw|ini|zip|json|file|vcf))$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]
##### Joomla! core SEF Section -- END
If you use joomla first disable ssl, than use above code because I have use this code also and its working.
RewriteEngine On RewriteCond %{HTTPS} on RewriteRule (.*) http://% {HTTP_HOST}%{REQUEST_URI} [R=301,L]
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.