Webmastersite.net
Register Log In

To access via non -www
Does not rewite without www. after regenerating.

Comments on To access via non -www

sharma22


Usergroup: Member
Joined: Apr 04, 2011

Total Topics: 7
Total Comments: 10
Posted Apr 11, 2011 - 2:28 AM:

I am able to redirect using following code in htaccess

RewriteCond %{HTTP_HOST} ^www\.(([a-z0-9_]+\.)?example\.com)$ [NC]
RewriteRule .? http://%1%{REQUEST_URI} [R=301,L]

I have changed the URL in system configuration without www. Also I replaced all instances of www.example.com with example.com in database. But When I regenerate, all rewrites in the directory URLs come back to www.example.com

Am I missing a step somewhere or is there any code in htaccess which is to be removed?
sharma22


Usergroup: Member
Joined: Apr 04, 2011

Total Topics: 7
Total Comments: 10
Posted Apr 11, 2011 - 3:17 AM:

I could finally fix the rewrite.

config.php file still had the $dirurl=http://www.example.com despite changing URL in system configuration to http://example.com
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Apr 11, 2011 - 9:41 AM:

Check which box you're changing. There's the overall site URL box, and then there's the WSN Links URL box which is the one that config.php uses.
Search thread for
Download thread as
  • 0/5
  • 1
  • 2
  • 3
  • 4
  • 5



Sorry, you don't have permission to post posts. Log in, or register if you haven't yet.