Www - with and without

Hi All!

I know little about server management so I just had to ask you guys…
I have a new community site for artists. I’m testing the site and realized the following issue : when I register and sign in (ALL without www : just http://my_site.com) and then typing www.my_site.com (or http://www.my_site.com), the site behaves as I’m not logged i.e. a new guest visitor… What I want is the server to behave the same in both cases : with and without ‘www’. I’ve tried a rewrite rule

RewriteEngine on
RewriteBase /

RewriteCond %{HTTP_HOST} ^my_site\\.com$
RewriteRule ^(.*) http://www.my_site.com/$1 [R=301]

but I couldn’t login at all, the site always showed the guest index page…
Your help - as always - is highly appreciated!

That’s not a good idea, as Google basically sees this as two separate sites. It’s better to choose one or the other and specify which to use via your .htaccess.

I see… I suppose I have to redirect i.e. ALL http://my_site.com TO http://www.my_site.com ??? With a .htaccess?

That’s the recommended approach—whether you choose to keep www or eliminate it (which is arguably a bit more modern).

This page has a lot of info on that:
READ THIS FIRST: Important links, an introduction to mod_rewrite, installing Apache - SitePoint Forums

If you go down half way, you’ll see how to “Force www for a Domain” and below that “Eliminate www for a Domain”.

I normally do it via .htaccess, but you can go and modify the Apache files themselves if you are into that stuff.