Hi,

(I apologize if this comes through twice, the first time didn't show up in the list. This is my first time contributing and maybe I didn't wait long enough or something.)

Two things. First about the www since you may have solved the rest, and then what Apache says about .htaccess. I assume you are using Apache and have a Virtual Private Server hosting account.

1) Do you have something like the following in your httpd.conf file? The first part should take care or you www access problem and the second part changes http requests into https requests.

<VirtualHost *:80>
    ServerName yourdomain.com
    ServerAlias www.yourdomain.com
    DocumentRoot /var/www/html
### next 3 lines change http access to https ###
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule ^(.*)$ https://www.yourdomain.com$1 [R=301,L]
</VirtualHost>

2) I would put the above in your httpd.conf file instead of .htaccess. The reason for this is explained in the Apache documentation at http://httpd.apache.org/docs/current/howto/htaccess.html in the When (not) to use .htaccess files section. Part is quoted below, but there is more:

"In general, you should never use .htaccess files unless you don't have access to the main server configuration file. There is, for example, a prevailing misconception that user authentication should always be done in .htaccess files. This is simply not the case. You can put user authentication configurations in the main server configuration, and this is, in fact, the preferred way to do things."

I hope this helps and that I have not misunderstood your problem.

Robert Alter


Lynn Stott (Stott Design) wrote:
Thanks Jamie for sticking with me!

This works when someone browses without the "www", but doesn't work with www.mysite.com

Thanks,
Lynn Stott
www.stottdesign.com
208.871.0073


On Jul 22, 2011, at 10:32 AM, Jamie Holly wrote:

Shouldn't have done it from memory LOL. Try this one:

RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)$ https://%{SERVER_NAME}$1 [L,R]


Jamie Holly
http://www.intoxination.net 
http://www.hollyit.net

On 7/22/2011 12:07 PM, Lynn Stott (Stott Design) wrote:
This doesn't work.

Thanks,
Lynn Stott
www.stottdesign.com
208.871.0073


On Jul 22, 2011, at 9:56 AM, Jamie Holly wrote:

Generic to force everything to ssl:

ReWriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]
Jamie Holly
http://www.intoxination.net 
http://www.hollyit.net

On 7/22/2011 11:52 AM, Lynn Stott (Stott Design) wrote:
Yes, Linux, VPS, not shared.

No support on this from my host... on my own with this and I just don't know .htaccess. 

Thanks,
Lynn Stott
www.stottdesign.com
208.871.0073


On Jul 22, 2011, at 8:17 AM, Shai Gluskin wrote:

Lynn,

Are you on a Linux server? I think you are talking about using a mod_rewrite solution which, I think, only works on Linux.

mod_rewrite is incredibly powerful and fussy. I wouldn't risk advising you on the actual script.

I actually think this kind of question might best be handled by the support team at your server company. I'm not saying you shouldn't ask here... but if you don't get a response that helps, that is another route to go.

Shai

On Fri, Jul 22, 2011 at 10:10 AM, Lynn Stott (Stott Design) <lynn@stottdesign.com> wrote:
Can some help with .htaccess? 

How do you redirect all 
https://www.site.com 
http://www.site.com 
http://site.com

to

https://site.com

Thanks,


--
[ Drupal support list | http://lists.drupal.org/ ]

--
[ Drupal support list | http://lists.drupal.org/ ]

--
[ Drupal support list | http://lists.drupal.org/ ]

--
[ Drupal support list | http://lists.drupal.org/ ]