View Full Version : HTTPS redirect
ekempter
12-31-2016, 07:47 PM
I'm trying to redirect all HTTP traffic to HTTPS. The following within .htaccess works to a point. if abc.com is typed in, the URL correctly converts to https://www.abc.com/vb4/. It does not work when an http link is provided. http://www.abc.com/vb4/showthread.php/123-post comes back as https://www.abc.com/showthread.php/123-post. Note that the vb4 directory is stripped from the URL which results in a 404. Thanks in advance for any assistance.
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://www.abc.com/$1 [R=301,L]
The htaccess rules you posted should work fine.
What happens when you disable those htaccess rules? Does it still happen or does it go to default behavior?
Paul M
12-31-2016, 11:46 PM
You could try changing (.*) to ^(.*)$, but I dont see why it would fail, unless maybe you have a RewriteBase messing things up in there somewhere.
Stratis
01-05-2017, 02:41 PM
I'm trying to redirect all HTTP traffic to HTTPS. The following within .htaccess works to a point. if abc.com is typed in, the URL correctly converts to https://www.abc.com/vb4/. It does not work when an http link is provided. http://www.abc.com/vb4/showthread.php/123-post comes back as https://www.abc.com/showthread.php/123-post. Note that the vb4 directory is stripped from the URL which results in a 404. Thanks in advance for any assistance.
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://www.abc.com/$1 [R=301,L]
This was given for my use from server support.
---------------------------------------------------------------------
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
---------------------------------------------------------------------
:)
RichieBoy67
01-06-2017, 04:44 PM
Best one for me is:
RewriteEngine On
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^www\.(.*)
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
Stratis
01-06-2017, 05:09 PM
Wow, this RewriteCond %{HTTPS} on
is absolute different than mine. Why so difference?
Do we know what "on" means?
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.