HungryMind Posted January 21, 2011 Share Posted January 21, 2011 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 More sharing options...
[dx] Posted January 21, 2011 Share Posted January 21, 2011 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. Link to comment Share on other sites More sharing options...
Ingolme Posted January 21, 2011 Share Posted January 21, 2011 I think you might be missing ${REQUEST_FILENAME} on the RewriteCond command. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.