archive about

Removing www. from your websites

Here is a short tip on how to remove "www." from your sites (and make sure others do not use it too). You will need mod_php (apache) enabled and PHP.

In the default virtual host base directory, make sure you have enabled mod_rewrite (check your Override directives if the following does not work), and add something like this in .htaccess: RewriteEngine On RewriteCond %{HTTP_HOST} ^www. RewriteRule ^(.*) go.php

Then put in the same directory go.php: < ? $g = str_replace('www.','',$_SERVER['HTTP_HOST']) ; header("Location: http://$g". $_SERVER["REQUEST_URI"]) ; ?>