Jump to content

non-www to www redirect


HungryMind
 Share

Recommended Posts

How to redirect non-www to wwwand www to non-wwwI used some commands, but it's not working :sRedirect www to non-www:

RewriteEngine OnRewriteBase /RewriteCond % ^www.yourdomain.com [NC]RewriteRule ^(.*)$ http://yourdomain.com/$1 [L,R=301]

Redirect non-www to www:

RewriteEngine OnRewriteBase /RewriteCond % ^yourdomain.com [NC]RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [L,R=301]

Link to comment
Share on other sites

By default is like that:It's same if you visit http://w3schools.com/ or http://www.w3schools.com/ or even www.w3schools.com/Note: I think this should be moved to Web servers section.And did you maybe added subdomain "www" via cPanel. Is yes, try delete, if not, try adding and redirect to your web. But it must work by default.

Edited by Haris S
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...