Link to home
Start Free TrialLog in
Avatar of zattz
zattz

asked on

301 rewrite www.*.com to *.com

Hi all,

I need to 301 redirect all requests from www.domain.com to domain.com

For one site (mysite.com) I would use the following:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.mysite\.com [nc]
RewriteRule (.*) http://mysite.com/$1 [R=301,L]

However, I need to do it in builk for all domains... IE: i need to rewrite www.* to *

It must work for all domains.. ie, com/info/net

I can't get the following to work:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [nc]
RewriteRule (.*) http://%1/$1 [R=301,L]
ASKER CERTIFIED SOLUTION
Avatar of jb1dev
jb1dev

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of zattz
zattz

ASKER

thx