Parked domain doesn"t work correctly without opening www

Parked domain doesn"t work correctly without opening www

am 14.01.2008 22:11:35 von Jason Carlton

I had mentioned in an earlier thread that I'm using several domains
parked on top of another domain, and based on the domain that's typed
in the visitor might see different information.

Originally, I had a problem that if they left off the trailing /, they
were being redirected to the main domain and not seeing the
information specific to the domain that they typed in. I was able to
resolve this by adding this to the .htaccess:

RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+[^/])$ $1/

However, I recently discovered that if they leave off the opening www,
the same problem happens. So, I need a way to see if the www is
present, and if not then plug it in.

I read through the Apache manual and didn't see a reference to this,
so I'm hoping you guys can help me out again. I know how to push
something to the end, but how do I get it at the beginning?

TIA,

Jason

Re: Parked domain doesn"t work correctly without opening www

am 15.01.2008 10:58:49 von phantom

"Jason Carlton" wrote in message
news:f678a10d-bb7a-4adf-8f38-f21bc0f76e67@e6g2000prf.googleg roups.com...
>I had mentioned in an earlier thread that I'm using several domains
> parked on top of another domain, and based on the domain that's typed
> in the visitor might see different information.
>
> Originally, I had a problem that if they left off the trailing /, they
> were being redirected to the main domain and not seeing the
> information specific to the domain that they typed in. I was able to
> resolve this by adding this to the .htaccess:
>
> RewriteCond %{REQUEST_FILENAME} -d
> RewriteRule ^(.+[^/])$ $1/
>
> However, I recently discovered that if they leave off the opening www,
> the same problem happens. So, I need a way to see if the www is
> present, and if not then plug it in.
>

something like this?

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

Re: Parked domain doesn"t work correctly without opening www

am 16.01.2008 10:14:06 von Jason Carlton

On Jan 15, 4:58=A0am, "phantom" wrote:
> "Jason Carlton" wrote in message
>
> news:f678a10d-bb7a-4adf-8f38-f21bc0f76e67@e6g2000prf.googleg roups.com...
>
>
>
>
>
> >I had mentioned in an earlier thread that I'm using several domains
> > parked on top of another domain, and based on the domain that's typed
> > in the visitor might see different information.
>
> > Originally, I had a problem that if they left off the trailing /, they
> > were being redirected to the main domain and not seeing the
> > information specific to the domain that they typed in. I was able to
> > resolve this by adding this to the .htaccess:
>
> > RewriteCond %{REQUEST_FILENAME} -d
> > RewriteRule ^(.+[^/])$ $1/
>
> > However, I recently discovered that if they leave off the opening www,
> > the same problem happens. So, I need a way to see if the www is
> > present, and if not then plug it in.
>
> something like this?
>
> RewriteCond %{HTTP_HOST} !^www\.
> RewriteRule (.*)http://www.%{HTTP_HOST}$1 [R=3D301,L]- Hide quoted text -

Thanks, Phantom! But when I plug that in, it takes me to
http://www.parkeddomain.compublic_html/, which of course just gives an
error that the domain doesn't exist.

If I remove the $1 in the RewriteRule, you can leave off the www when
going to the homepage (which is 1000 times better than before!), but
not an internal directory. So, http://parkeddomain.com works, but not
http://parkeddomain.com/directory/ (this will redirect to the main
domain instead of the parked one).

I was, however, able to make this work:

RewriteCond %{HTTP_HOST} !^www\.
RewriteRule (.*) http://www.%{HTTP_HOST}%{REQUEST_URI} [R=3D301,L]

I'm not sure if this is the BEST option, but it does work.

Thanks again, Phantom,

Jason