• 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 (https://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 https://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:

    1. Export the entire database in SQL format and delete the existing database in phpMyAdmin
    2. Do a global search and replace on development domain name for live domain name
    3. Import the edited SQL back into phpMyAdmin
    4. Re-name the top level directory of your WordPress installation to the domain name of the live site
    5. Keep your fingers crossed!
Viewing 2 replies - 1 through 2 (of 2 total)
  • Storing the full website URL with every single content item seems to me a very inefficient way to construct a database

    Sorry but right now that’s just how the permalink system works.

    As for moving your site from a development to a live server, see Moving_WordPress.

    Thread Starter Praggers

    (@praggers)

    Thanks for the information about the special script. I do hope the database developers are considering a move to Third Normal Form at some point.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Full website URL is stored in the database for every post!’ is closed to new replies.