WordPress Tip: Oh Noes! I Changed My URL and Now I Can’t Access My Site!

I see this one happen all the time over on the forums.  I changed my blog URL and now I can’t access my site/can’t access my admin/my styling is all jacked up, etc.  This happens a lot because host automated installer scripts often put your site in a WordPress folder, so your URL ends up being domain.com/wordpress or something like that.  The important thing to know here is that you can’t just change this URL.  It actually points somewhere, it’s pointing to your WordPress files on your server.

Luckily, this isn’t real hard to remedy.  We’ll start off by trying to stop the problem in the first place, if it’s too late for that we’ll fix the problem.  Don’t just change the URL.  There is a process in place.  You have 2 options.  You can move your WordPress install entirely to root (public_html, html) or you can mostly leave your site in its folder but run it from root.  Root here is your base level server web-accessible folder.  What that means to you, is the site would run from domain.com.  No extra directory like /wordpress in the URL.  Before we get started, lets look at the codex.  These 2 selections tell you how to move WordPress, or how to leave it in its own directory, but run from root.

The first link is pretty self-explanatory.  If you want to move your install to root to run your site from domain.com, just follow those instructions and you are all set!  The second link is not  so easy.  The process is easy, but the article was authored from the perspective of having your install already in root, and wishing to keep running it from root, but moving your files to another directory.  I like this option as it keeps your files less cluttered.  You may run many domains from one host/server, or many software/website options.  So I like to have each in their own folder.  It’s best to read and understand the instructions from the second link, but here’s a quick overview of how to use the instructions if you are already installed in a subdirectory (like /wordpress) and want to leave your files there but run from root, domain.com.

  1. Leave WordPress URL set to the location of your files (like http://domain.com/wordpress)
  2. Change the Site Address URL to root (http://domain.com)
  3. Save Changes, Do not worry about any error messages you may get, or anything acting up)
  4. Copy your index.php (the WordPress main one, not the one in your theme) and .htaccess files (you will only have one if using pretty permalinks) to root (html, public_html)
  5. Open the index.php file you just copied to root in a text editor
  6. Find the line require('./wp-blog-header.php');
  7. Edit that to read require('./wordpress/wp-blog-header.php');
  8. Now you can login to your admin section, it’s important to note that your site is now accessible at domain.com, however your admin section still runs from domain.com/wordpress/wp-admin
  9. Head to the permalinks menu and update your permalinks.  You may need to save them to default then back to custom

That’s it!  Not so hard either way!  OK, that takes care of the setup.  But what if you already changed your URL and can’t get into your site?  This is really easy actually.  You won’t have access to your admin panel, but you can simply change your URL back to original using phpmyadmin, or an edit to your wp-config file.  The options are all listed here.  Use one of the methods, change your URL back to original and once you have access, if you want to properly change your URL use one of the above methods.

css.php
%d bloggers like this: