vrypan — panayotis vryonis
My blog is a digital scrapbook of ideas, thoughts and personal events. My home is vrypan.net.
Home — Archive: All · English · Greek — RSS Feeds: full feed · other options
#web-devel #en

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"]) ; ?>

Share this post:
The Letter is a newsletter I send out whenever I have something to say or share. It may take a few days, weeks or months for the next one.
Privacy: I hate spam as much as you do, maybe more. I will not share your email with advertisers, etc.