Using .htaccess to force rewriting URLs to https:// works but loses any subdirectory paths. What do I need to change?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello everybody,

I'm hosting my website at a shared-host so I have control limited to
using .htaccess.

I just got an SSL certificate set up and want to make sure that
everything at my site always uses the https://Domain.com address and
the certificate.

Reading around alot, I made some progress by putting this in the
/webroot/.htaccess file:

	Options +FollowSymLinks
	
	SSLOptions +StrictRequire
	SSLRequireSSL
	SSLRequire %{HTTP_HOST} eq "www.Domain.com"
	ErrorDocument 403 https://www.Domain.com
	
	RewriteEngine      on
	RewriteBase        /
	
	RewriteCond %{HTTPS} !=on
	RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
	

With this in there if I go to any of these URLs,

	http://Domain.com
	http://www.Domain.com
	https://Domain.com
	https://www.Domain.com

I end up at https://www.Domain.com like I'd hoped.

But when I go to any subdirectory

	http://Domain.com/something
	http://www.Domain.com/something
	https://Domain.com/something
	https://www.Domain.com/something

I STILL end up at just https://www.Domain.com, instead of preserving
the subdirectory path. In other words ending up at:

	https://www.Domain.com/something

What do I need to change or add to get the subdirectory paths to
"stick" after changing to the https:// ?

Bob

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux