Domain URL; www vs (not www)

Domain URL; www vs (not www)

am 17.07.2007 16:56:02 von Christoph

I have a website set up for my domain. Say it's mydomain.com. Users can
access it using either of the following URLs:

http://mydomain.com

http://www.mydomain.com

What configuration option is allowing the user to access it using the first
URL? What can I change to make it so that they can only access it using the
"www."?

thnx,
Christoph

Re: Domain URL; www vs (not www)

am 17.07.2007 18:17:03 von David Kerber

In article ,
jcboget@yahoo.com says...
> I have a website set up for my domain. Say it's mydomain.com. Users can
> access it using either of the following URLs:
>
> http://mydomain.com
>
> http://www.mydomain.com
>
> What configuration option is allowing the user to access it using the first
> URL? What can I change to make it so that they can only access it using the
> "www."?

AFAIK, that's a function of your ISP's DNS settings, and there's not a
whole lot you can do about it.

--
Remove the ns_ from if replying by e-mail (but keep posts in the
newsgroups if possible).

Re: Domain URL; www vs (not www)

am 17.07.2007 19:17:07 von Paul Furman

David Kerber wrote:

> In article ,
> jcboget@yahoo.com says...
>
>>I have a website set up for my domain. Say it's mydomain.com. Users can
>>access it using either of the following URLs:
>>
>>http://mydomain.com
>>
>>http://www.mydomain.com
>>
>>What configuration option is allowing the user to access it using the first
>>URL? What can I change to make it so that they can only access it using the
>>"www."?
>
> AFAIK, that's a function of your ISP's DNS settings, and there's not a
> whole lot you can do about it.

You can shut down the non-www access, I pay extra to enable it with my
hosting service. Is your problem wanting to re-direct urls to the www
version? What harm does the non-www do? I think .htaccess has ways of
redirecting & substituting if you have that option at your server.

--
Paul Furman Photography
http://www.edgehill.net/1
Bay Natives Nursery
http://www.baynatives.com

Re: Domain URL; www vs (not www)

am 17.07.2007 19:38:29 von Christoph

>>>I have a website set up for my domain. Say it's mydomain.com. Users can
>>>access it using either of the following URLs:
>>>http://mydomain.com
>>>http://www.mydomain.com
>>>What configuration option is allowing the user to access it using the
>>>first URL? What can I change to make it so that they can only access it
>>>using the "www."?
>> AFAIK, that's a function of your ISP's DNS settings, and there's not a
>> whole lot you can do about it.

So that's not something I'd have control over in the httpd.conf?

> You can shut down the non-www access, I pay extra to enable it with my
> hosting service. Is your problem wanting to re-direct urls to the www
> version? What harm does the non-www do?

Well, we have a SSL certificate for www.mydomain.com but not for
mydomain.com. IOW, it's not a wildcard certificate.

> I think .htaccess has ways of redirecting & substituting if you have that
> option at your server.

Do you know where I can go to find out how to do this?

thnx,
Christoph

Re: Domain URL; www vs (not www)

am 17.07.2007 19:54:44 von Paul Furman

Christoph wrote:

>>>>I have a website set up for my domain. Say it's mydomain.com. Users can
>>>>access it using either of the following URLs:
>>>>http://mydomain.com
>>>>http://www.mydomain.com
>>>>What configuration option is allowing the user to access it using the
>>>>first URL? What can I change to make it so that they can only access it
>>>>using the "www."?
>>>
>>>AFAIK, that's a function of your ISP's DNS settings, and there's not a
>>>whole lot you can do about it.
>
> So that's not something I'd have control over in the httpd.conf?

Maybe, I don't know.

>>You can shut down the non-www access, I pay extra to enable it with my
>>hosting service. Is your problem wanting to re-direct urls to the www
>>version? What harm does the non-www do?
>
> Well, we have a SSL certificate for www.mydomain.com but not for
> mydomain.com. IOW, it's not a wildcard certificate.
>
>>I think .htaccess has ways of redirecting & substituting if you have that
>>option at your server.
>
>
> Do you know where I can go to find out how to do this?

http://www.google.com/search?q=.htaccess+redirecting+substit uting
Sorry I can't help more but it should be controllable this way. And call
to ask your host what is allowed.


--
Paul Furman Photography
http://www.edgehill.net/1
Bay Natives Nursery
http://www.baynatives.com

Re: Domain URL; www vs (not www)

am 17.07.2007 21:30:37 von mark

"Christoph" wrote in
news:KZKdnYpaJtsNRQHbnZ2dnUVZ_q-jnZ2d@comcast.com:

> I have a website set up for my domain. Say it's mydomain.com. Users
> can access it using either of the following URLs:
>
> http://mydomain.com
>
> http://www.mydomain.com
>
> What configuration option is allowing the user to access it using the
> first URL? What can I change to make it so that they can only access
> it using the "www."?
>
> thnx,
> Christoph
>
>

Remove the A record so that mydomain.com does not resolve but
www.mydomain.com does, and remove the ServerAlias or ServerName
mydomain.com line from your server configuration.

You might also need to make your server a virtual server using a second
VirtualHost container in the first position as a catchall with a "Host
not Found" error page as the index page.





--

----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----

Re: Domain URL; www vs (not www)

am 17.07.2007 22:06:29 von sean dreilinger

hi Christoph:

Christoph wrote:
> http://mydomain.com
> http://www.mydomain.com
> What configuration option is allowing the user to access it using the first
> URL? What can I change to make it so that they can only access it using the
> "www."?

the apache configuration option that tells apache to answer requests for
different hostnames (other than the primary ServerName) is ServerAlias. for your
example below, you probably have something like:

ServerName www.mydomain.com
ServerAlias mydomain.com

this is a good idea, you don't want to shut customers out simply because they're
too lazy to type in "www." in front of your domain name.

but enforcing a canonical hostname is also a useful for setting cookies,
enforcing audience tracking, and accruing rank under a single domain or hostname.

the mod_rewrite guide has a stanza showing how to use mod_rewrite to enforce a
canonical hostname (e.g. redirect requests for any ServerAlias'd hostname to the
canonical hostname):

http://httpd.apache.org/docs/1.3/misc/rewriteguide.html

an .htaccess file using your sample hostname would look like this:


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



hth

--
sean dreilinger - http://durak.org/sean/

Re: Domain URL; www vs (not www)

am 18.07.2007 10:06:44 von david

Christoph wrote:
>>>> I have a website set up for my domain. Say it's mydomain.com. Users can
>>>> access it using either of the following URLs:
>>>> http://mydomain.com
>>>> http://www.mydomain.com
>>>> What configuration option is allowing the user to access it using the
>>>> first URL? What can I change to make it so that they can only access it
>>>> using the "www."?
>>> AFAIK, that's a function of your ISP's DNS settings, and there's not a
>>> whole lot you can do about it.
>
> So that's not something I'd have control over in the httpd.conf?
>
>> You can shut down the non-www access, I pay extra to enable it with my
>> hosting service. Is your problem wanting to re-direct urls to the www
>> version? What harm does the non-www do?
>
> Well, we have a SSL certificate for www.mydomain.com but not for
> mydomain.com. IOW, it's not a wildcard certificate.

Thats odd. All the SSL certificates I have gotten work both on the
domain.com and the www.domain.com

If you really feel that you must only allow the www.domain.com than use
..htaccess and redirect the domain.com.

>
>> I think .htaccess has ways of redirecting & substituting if you have that
>> option at your server.
>
> Do you know where I can go to find out how to do this?
>
> thnx,
> Christoph
>
>

Re: Domain URL; www vs (not www)

am 18.07.2007 10:25:42 von David McKenzie

David wrote:
> Christoph wrote:
>>>>> I have a website set up for my domain. Say it's mydomain.com.
>>>>> Users can access it using either of the following URLs:
>>>>> http://mydomain.com
>>>>> http://www.mydomain.com
>>>>> What configuration option is allowing the user to access it using
>>>>> the first URL? What can I change to make it so that they can only
>>>>> access it using the "www."?
>>>> AFAIK, that's a function of your ISP's DNS settings, and there's not
>>>> a whole lot you can do about it.
>>
>> So that's not something I'd have control over in the httpd.conf?
>>
>>> You can shut down the non-www access, I pay extra to enable it with
>>> my hosting service. Is your problem wanting to re-direct urls to the
>>> www version? What harm does the non-www do?
>>
>> Well, we have a SSL certificate for www.mydomain.com but not for
>> mydomain.com. IOW, it's not a wildcard certificate.
>
> Thats odd. All the SSL certificates I have gotten work both on the
> domain.com and the www.domain.com
>
> If you really feel that you must only allow the www.domain.com than use
> .htaccess and redirect the domain.com.
>
>>
That's correct, SSLs will work on the non-www, but will throw an error
onto the screen, which most consumers shy away from. You could either
use a htaccess file to redirect, or you could change the VirtualHost
section in httpd.conf.

--
DM davidm@cia.com.au

The funny .sig is in the wash, I am your replacement.

Re: Domain URL; www vs (not www)

am 19.07.2007 00:39:41 von unknown

Post removed (X-No-Archive: yes)

Re: Domain URL; www vs (not www)

am 19.07.2007 00:51:35 von xicheng

On Jul 17, 10:56 am, "Christoph" wrote:
> I have a website set up for my domain. Say it's mydomain.com. Users can
> access it using either of the following URLs:
>
> http://mydomain.com
>
> http://www.mydomain.com
>
> What configuration option is allowing the user to access it using the first
> URL? What can I change to make it so that they can only access it using the
> "www."?
>
> thnx,
> Christoph

Guess you can set RewriteRule and use RewriteCond with %{HTTP_HOST}
parameters. check the following link:

http://httpd.apache.org/docs/2.0/misc/rewriteguide.html#url

Regards,
Xicheng

Re: Domain URL; www vs (not www)

am 19.07.2007 04:03:31 von Paul Furman

SnowBlind wrote:

> On Wed, 18 Jul 2007 18:25:42 +1000, David McKenzie
> wrote:
>
>
>>David wrote:
>>
>>>Christoph wrote:
>>>
>>>>>>>I have a website set up for my domain. Say it's mydomain.com.
>>>>>>>Users can access it using either of the following URLs:
>>>>>>>http://mydomain.com
>>>>>>>http://www.mydomain.com
>>>>>>>What configuration option is allowing the user to access it using
>>>>>>>the first URL? What can I change to make it so that they can only
>>>>>>>access it using the "www."?
>>>>>>
>>>>>>AFAIK, that's a function of your ISP's DNS settings, and there's not
>>>>>>a whole lot you can do about it.
>>>>
>>>>So that's not something I'd have control over in the httpd.conf?
>>>>
>>>>
>>>>>You can shut down the non-www access, I pay extra to enable it with
>>>>>my hosting service. Is your problem wanting to re-direct urls to the
>>>>>www version? What harm does the non-www do?
>>>>
>>>>Well, we have a SSL certificate for www.mydomain.com but not for
>>>>mydomain.com. IOW, it's not a wildcard certificate.
>>>
>>>Thats odd. All the SSL certificates I have gotten work both on the
>>>domain.com and the www.domain.com
>>>
>>>If you really feel that you must only allow the www.domain.com than use
>>>.htaccess and redirect the domain.com.
>>>
>>>
>>That's correct, SSLs will work on the non-www, but will throw an error
>>onto the screen, which most consumers shy away from. You could either
>>use a htaccess file to redirect, or you could change the VirtualHost
>>section in httpd.conf.

Right, that's the other place to set it.

> You certificate should have been for domain.com not www.domain.com.
> This the error that creates the issue. I had this once before and had
> to rewrite the ccr request to correct the error about the domain name
> match. Once the corrected cert was installed it had no more errors.
> FYI www. is a standard for most all domain addresses and if you type
> domain.com in your browser it should rewrite/translate it as
> www.domain.com unless you've configured the browser or server to do
> otherwise. For example type google.com in your browser and it comes up
> as http://www.google.com. The easy solution is to point domain.com to
> www.domain.com in the DNS if you can access that configuration. Else
> use apache directives to rewrite or redirect the url.

Wouldn't it be cleaner & nicer if everyone dropped the www? I'd be
inclined to redirect & rewrite with no www.

--
Paul Furman Photography
http://www.edgehill.net/1
Bay Natives Nursery
http://www.baynatives.com

Re: Domain URL; www vs (not www)

am 19.07.2007 04:08:11 von David McKenzie

Paul Furman wrote:
> SnowBlind wrote:
>
>> On Wed, 18 Jul 2007 18:25:42 +1000, David McKenzie
>> wrote:
>>
>>
>>> David wrote:
>>>
>>>> Christoph wrote:
>>>>
>>>>>>>> I have a website set up for my domain. Say it's mydomain.com.
>>>>>>>> Users can access it using either of the following URLs:
>>>>>>>> http://mydomain.com
>>>>>>>> http://www.mydomain.com
>>>>>>>> What configuration option is allowing the user to access it
>>>>>>>> using the first URL? What can I change to make it so that they
>>>>>>>> can only access it using the "www."?
>>>>>>>
>>>>>>> AFAIK, that's a function of your ISP's DNS settings, and there's
>>>>>>> not a whole lot you can do about it.
>>>>>
>>>>> So that's not something I'd have control over in the httpd.conf?
>>>>>
>>>>>
>>>>>> You can shut down the non-www access, I pay extra to enable it
>>>>>> with my hosting service. Is your problem wanting to re-direct urls
>>>>>> to the www version? What harm does the non-www do?
>>>>>
>>>>> Well, we have a SSL certificate for www.mydomain.com but not for
>>>>> mydomain.com. IOW, it's not a wildcard certificate.
>>>>
>>>> Thats odd. All the SSL certificates I have gotten work both on the
>>>> domain.com and the www.domain.com
>>>>
>>>> If you really feel that you must only allow the www.domain.com than
>>>> use .htaccess and redirect the domain.com.
>>>>
>>>>
>>> That's correct, SSLs will work on the non-www, but will throw an
>>> error onto the screen, which most consumers shy away from. You could
>>> either use a htaccess file to redirect, or you could change the
>>> VirtualHost section in httpd.conf.
>
> Right, that's the other place to set it.
>
>> You certificate should have been for domain.com not www.domain.com.
>> This the error that creates the issue. I had this once before and had
>> to rewrite the ccr request to correct the error about the domain name
>> match. Once the corrected cert was installed it had no more errors.
>> FYI www. is a standard for most all domain addresses and if you type
>> domain.com in your browser it should rewrite/translate it as
>> www.domain.com unless you've configured the browser or server to do
>> otherwise. For example type google.com in your browser and it comes up
>> as http://www.google.com. The easy solution is to point domain.com to
>> www.domain.com in the DNS if you can access that configuration. Else
>> use apache directives to rewrite or redirect the url.
>
> Wouldn't it be cleaner & nicer if everyone dropped the www? I'd be
> inclined to redirect & rewrite with no www.
>
Sure it would be nicer, but we have about as much chance of that as we
do moving to IPv6 in my life span.

--
DM davidm@cia.com.au

The funny .sig is in the wash, I am your replacement.

Re: Domain URL; www vs (not www)

am 19.07.2007 17:02:09 von Christoph

> an .htaccess file using your sample hostname would look like this:
>
> RewriteCond %{HTTP_HOST} !^www\.mydomain\.com [NC]
> RewriteCond %{HTTP_HOST} !^$
> RewriteRule ^/(.*) http://www\.mydomain\.com/$1 [L,R]
>


Wouldn't the first check look like this:

RewriteCond %{HTTP_HOST} !^mydomain\.com [NC]

since I'm checking for (and ultimately rewriting) the use of mydomain.com?
Also, what exactly is this rule

RewriteCond %{HTTP_HOST} !^$

doing? It seems like it's taking the value of HTTP_HOST and turning it into
an empty value?

thnx,
Christoph

Re: Domain URL; www vs (not www)

am 19.07.2007 21:31:38 von sean dreilinger

hi Christoph - good questions, let me step through the sample mod_rewrite code.
nb this is an almost verbatim example from the mod_rewrite manual:



^^ if mod_rewrite is not available, skip this altogether...

RewriteCond %{HTTP_HOST} !^www\.mydomain\.com [NC]

^^ condition: make sure the client is asking for any hostname _except_ the
correct one. '!' negates the match, so we're saying this condition is met by
anything _except_ your canonical hostname. NC means case insensitive.

RewriteCond %{HTTP_HOST} !^$

^^ condition: the client browser must not send an empty host client header. if
the client doesn't support host headers, you can't redirect their browser to a
virtually hosted website on the same IP address (which i assume you're trying to
do). if you omit this condition, you can end up creating a redirect loop for
older browsers or spiders that do not support the http host client header.

RewriteRule ^/(.*) http://www.mydomain.com/$1 [L,R]

^^ rule - if all preceding rewrite conditions are met, capture the requested URI
(.*) and generate a redirect to the canonical URL by combining
http://www.mydomain.com/ with the captured URI (stored in $1).



see the mod_rewrite docs for more explanation/info:
http://httpd.apache.org/docs/1.3/misc/rewriteguide.html

hth
-sean


Christoph wrote:
> Wouldn't the first check look like this:
> RewriteCond %{HTTP_HOST} !^mydomain\.com [NC]
> since I'm checking for (and ultimately rewriting) the use of mydomain.com?
> Also, what exactly is this rule
> RewriteCond %{HTTP_HOST} !^$
> doing?
> It seems like it's taking the value of HTTP_HOST and turning it into
> an empty value?

--
sean dreilinger - http://durak.org/sean/

Re: Domain URL; www vs (not www)

am 15.08.2007 00:38:22 von Hans-Peter Sauer

"sean dreilinger" wrote in message
news:469D2145.8030809@durak.org...
> hi Christoph:
>
> Christoph wrote:
>> http://mydomain.com
>> http://www.mydomain.com
>> What configuration option is allowing the user to access it using the
>> first
>> URL? What can I change to make it so that they can only access it using
>> the
>> "www."?
>
> the apache configuration option that tells apache to answer requests for
> different hostnames (other than the primary ServerName) is ServerAlias.
> for your
> example below, you probably have something like:
>
> ServerName www.mydomain.com
> ServerAlias mydomain.com


Server alias doesn't work for me. Any ideas????

Re: Domain URL; www vs (not www)

am 15.08.2007 01:10:43 von patpro

In article <13c4bn1biv8rq83@corp.supernews.com>, "Jim"
wrote:

> "sean dreilinger" wrote in message
> news:469D2145.8030809@durak.org...
> > hi Christoph:
> >
> > Christoph wrote:
> >> http://mydomain.com
> >> http://www.mydomain.com
> >> What configuration option is allowing the user to access it using the
> >> first
> >> URL? What can I change to make it so that they can only access it using
> >> the
> >> "www."?
> >
> > the apache configuration option that tells apache to answer requests for
> > different hostnames (other than the primary ServerName) is ServerAlias.
> > for your
> > example below, you probably have something like:
> >
> > ServerName www.mydomain.com
> > ServerAlias mydomain.com
>
>
> Server alias doesn't work for me. Any ideas????

make sure "mydomain.com" resolve into the same IP as www.mydomain.com

patpro

--
http://www.patpro.net/