Forum Topic: redirecting wwww to www

Forum: .htaccess Forum : Redirecting • Posted by Dave Austin • Updated:

Recently it become apparent that I need to redirect to www when user input wwww, ww and w by mistake. I am sure i should be able to do the with .htacess but not having much luck.

Because of the way my server is set up everytime someone uses a wrong combination of the w's they get redirected to the first site in my domains folder which houses all my sites.

So for example if I have two domain in the domains folder, 123.com and xyz.com and the user enters wwww.xyz.com they arrive at www.123.com, I want them to arrive at www.xyz.com.

Am I right in think I can do this with .htaccess, the server is ubuntu linux

If this can be dne could you give me an example please

Thanks

Dave

2 Replies to “redirecting wwww to www”

Jeff Starr
Posted by Jeff Starr

Yes as long as .htaccess is enabled on the server, it should work fine. Please see chapter 5.1 in the book for www and no-www techniques.

Posted by Dave Austin •

Thanks Jeff I will take a look at this in the book

cheers

Dave