Changing the Site URL in WordPress

Posted In WordPress - By NitiN Kumar Jain On Wednesday, January 13th, 2010 With 0 Comments

Pin It

Few days back I had setup a personal profile for Ankit @ I use Dreamhost web hosting so while adding this domain I mistakenly selected the following option

Add WWW: Make redirect to”

i.e. the site should always redirect to the domain name prefixed with www.

I installed wordpress on it and set it up completely.

After couple of days I thought of not having WWW in the beginning as it is a subdomain and subdomains generally don’t have WWW prefixed with them. It was making the domain name longer too. So I thought of removing it.

I went back to dreamhost panel and modified the domain to select the last option

Remove WWW: Make redirect to”

I then tried to open the website in a browser and to my surprise it did not open at all. I noticed in the status bar of the browser that it was trying to navigate to, within a second it was trying to navigate to and it kept on happening i.e. it was trying to find the URL where to navigate to but was unable to resolve it.

After thinking for a while, I realized that wordpress also stores site url within it. So, when I first installed wordpress on the domain, the domain name was That means wordpress has stored this domain name in its database. Later, I changed dreamhost to redirect it to i.e. without www.

So what was happening was that dreamhost was redirecting it to and wordpress was again redirecting it to so an infinite loop in resolving the url.

I encountered this error for the first time in my life. Solution to this problem is extremely easy too.

We can simply modify the Site URL property in wordpress.

Since we cannot access wp-admin, we are either required to access it via ftp or we can change it in the database via mySql access.

Different methods have been explained here but the one that I preferred and is really quick is by adding two properties in wp-config.php

We have to add these two lines to our wp-config.php, where “” is the new location of our site ( in my case)



These properties are also useful when we move our blog to a completely new domain i.e. from to

Really quick, isn’t it?? Hope it helps!!

Changing the Site URL in WordPress