Administrators and developers using WordPress for the first time can come in for an awful shock (this has just happened to me!): the FULL website URL is stored in the database for every single post! This has serious ramifications if, like me, you like to kick off website development on your own off-line computer using a localhost server stack such as WAMP, XAMP or MAMP (according to your hardware). It is only after a new site is working perfectly and looks beautiful that we then upload the entire site and its database to a live server.
This is when the problem with full website URL storage can wreak havoc if there is any difference between the new site’s development server URL and live server URL. If, like me, you call your in-development site something like sandbox (
http://localhost/sandbox) and then re-name it to something like brilliant-new-site.com when it goes live, you won’t even be able to login! That’s because the database still thinks the login page is at
http://localhost/sandbox. Worse, all the existing content items will be tagged with the same development URL, so they won’t be reachable either.
Storing the full website URL with every single content item seems to me a very inefficient way to construct a database given that every single content item also has a unique ID in the same database table (perhaps there is some historic reason why this approach was taken? Whatever it was, this structure seems to be what we are stuck with).
If you find yourself in this situation, I can suggest a work-around. This is to use something like phpMyAdmin to:
- Export the entire database in SQL format and delete the existing database in phpMyAdmin
- Do a global search and replace on development domain name for live domain name
- Import the edited SQL back into phpMyAdmin
- Re-name the top level directory of your WordPress installation to the domain name of the live site
- Keep your fingers crossed!
- The topic ‘Full website URL is stored in the database for every post!’ is closed to new replies.