So how exactly does Stack Overflow (along with other internet sites) take away the 'www' prefix when it is joined included in a URL?

Could it be a redirect, a rewrite or something like that else entirely?

Update: I'd particularly prefer to know poor IIS 6

Firing up Fiddler, we are able to observe that the server reactions having a "301 Moved Permanently" status and refers it to . Since StackOverflow is located on Home windows 2k8 IIS7 they setup this redirect immediately in IIS7.


a listing of HTTP statuses

If you're a .Internet developer you may know "Respose.Redirect" , this produces a 302 Object Moved status. Search engines like google like 301 status codes within this situation better, simply because they know they ought to not return to world wide later on.

A good way to get this done is applying the Apache "Redirect" directive:

<VirtualHost *:80>

    ServerName world wide

    Redirect permanent /


<VirtualHost *:80>


    # all server configuration goes here


The Redirect directive instantly preserves anything following a / within the URL. I've found this process simpler to see and understand compared to Rewrite method.

On Apache, it appears such as this (in a .htaccess file):

RewriteEngine On

RewriteCond % ^world wide$ [NC]

RewriteRule ^(.*)$$1 [R=301,L]

redirect. the sub-domain "world wide" would simply redirect to "".

It can be done a number of ways, using mod_rewrite and redirecting is my personal favorite. Something similar to this:

RewriteEngine On

RewriteCond % ^world wide$ [NC]

RewriteRule ^(.*)$$1 [R=301,L]

You'll need a default dns entry added pointing for your web server.

ping and verify ip is pointing to webserver, otherwise you need the default DNS entry added.

for any fundamental setup:

You will need to add host headers http://world wide

Create 1 site having a hostheader of world wide

In your home Directory tab, place it to some permanent redirect to

Produce a second site having a host header of

If you would like world wide to redirect to you may need a more complex setup with something similar to ISAPI_Rewrite or use custom 404 pages to get it done.

This really is going a lengthy long ago, but so far as I understand this can be a DNS setup. I believe you don't have to specify a number address (World wide web may be the title from the host (or computer/cluster...) the site resides on/in.).

I believe after that you can arrange it to transmit all demands to some default host.

Not 100% sure, but take a look at what's possible with DNS.

Hope that can help or at best get's you pointed in the right direction.

That you can do what mod_rewrite does for Apache, having a comparable URL rewriter for IIS. A high quality one is IIRF. The rule is:

RewriteCond  %  ^$     [I]

RedirectRule ^(.*)$$1   [R=301]

You may also wildcard the hostname like so:

RewriteCond  %  ^(.+)$    [I]

RedirectRule ^(.*)$$1   [R=301]

IIRF is free of charge.