Note: I cannot be root on example.com, so editing httpd.conf isn't an option.
I want anything from http://example.com to redirect to be https and including the slash directory. This is an example of the problem. The same problem if it is http://www... or http://example.com...
If the URL looks like this:
http://www.example.com/suggestions
It incorrectly redirects to the home page:
https://www.example.com/index.php
When the desired result is for it to redirect to here:
https://www.example.com/suggestions
Here is the .htaccess code I'm using:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.example\.com$
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
As far as I can tell is you are aming at forcing to use https on all request - right?
Quick Google search gave me:
A quick breakdown of what it means:
RewriteCond
tells this applies to all requests which is not called using HTTPS.Two things goes on in the
RewriteRule
:1)
/?(.*)
says it has to match everything in the path, which is then stored in the built in variable$1
.2)
%{SERVERNAME}
is a built in variable referring to servername (www.example.com in your case).So RewriteRule basically says: Match everything in the path and redirect to its HTTPS counterpart on the same domain.