ayksolutions
01-22-2007, 10:53 PM
Hey all,
Trying to force SSL when putting in http://helpdesk.ayksolutions.com so it goes to https://helpdesk.ayksolutions.com. So far, no luck. I've used mod_rewrite, but I think I'm doing something wrong.
I also used Redirect permanent to redirect all http based requests to https://helpdesk.ayksolutions.com
Any ideas on how to do this?
insanelymacintosh
01-23-2007, 01:09 AM
RewriteEngine on
RewriteOptions inherit
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [L,R]
I use this with Apache 1.3 on a full domain www.domainname.com, not too sure if it will work with a subdomain but should...
ayksolutions
01-23-2007, 03:51 AM
Thanks for the comments. I've tried that out, without the inherit option and while it does work, it doesn't work 100% correctly. So, I am looking for another way.
Xeentech
01-23-2007, 05:46 AM
I set-up I different vhost for the SSL site vs the non-SSL. In the non-SSL vhost block I just have Redirect https://site.com/
This way there's no possibility of the site ever loading over a non-SSL connection, which IMO is better than matching the HTTPS with Rewrite in case it ever failed. Some one could update the .htaccess in the future and break it etc..
the_pm
01-23-2007, 11:10 AM
I'm shocked 301 didn't work for you. What happens when you try it? Does it simply fail? Can you set it up so I can see it?
ayksolutions
01-23-2007, 12:59 PM
Well, the thing here is, 301 does work. However, when someone types in ayksolutions.com/helpdesk it takes them to https://helpdesk.ayksolutions.com/helpdesk which returns the 404. That's the problem with that. I suppose that's what I'm trying to find a work around for.
That link does work now because I don't have the 301 setup at the moment.
just create two virtual vhosts inside httpd.conf one for ssl and one for non-ssl
and create a 404.shtml to point to the ssl version and a regular meta-refresh tag for the index page to redirect to the ssl'ed index
thats what how i did it
ayksolutions
01-25-2007, 08:56 AM
that's a good idea. I will give that a shot.