views:

32

answers:

1

I have several websites that I use a subdomain as part of the main url.

subdomain.domain.com

When someone enters www.subdomain.domain.com they get an error, I want to redirect that to subdomain.domain.com.

Thanks in advance!

A: 

Assuming you have mod_rewrite enabled:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(.*)$
RewriteRule .* http://%1%{REQUEST_URI} [L]
qmega