Use the .htaccess file with some mod_rewrite rules:
RewriteEngine On RewriteRule ^www.SERVERNAME(.*) http://SERVERNAME$1 [L,QSA]
I'm not sure I got the syntax with $1 , but it is well documented. L sends the location: header to the browser, and QSA means adding a query string.
source share