Changing a WordPress Site URL
This tutorial will show you the steps for changing a WordPress Site URL
WordPress stores two addresses inside the database. These determine where your blog files are, and where the main index is. On a normal install, these addresses are the same. There are two occasions where you will need to access the database to alter one or both of these settings:
- If you have tried to alter the Blog URL or WordPress URL in Options and an error has occurred.
- If you have moved to a domain/subdomain with a different name.
BACKUP your database before you begin and store the backup off your site server, like on your hard drive. Quick fix methodIf you have access to the site via FTP, then this method will help you quickly get a site back up and running, if you changed those values incorrectly.
- Connect to your site via FTP;
- Navigate to the current active theme’s folder and get a copy of the functions.php file. You’re going to edit it in a simple text editor (like notepad) and upload it back to the site.
The normal file directory for this is “wp-content > themes > themname > functions.php” - Add these two lines to the file, immediately after the initial “
- update_option(‘siteurl’,’http://example.com/blog’);
- update_option(‘home’,’http://example.com/blog’)
Use your own URL instead of example.com, obviously.
{gallery}wordpressurl{/gallery} - Upload the file back to your site, in the same location. FileZilla offers a handy “edit file” function to do all of the above rapidly, if you can use that, do so.
- Load the login or admin page a couple of times. The site should come back up.
- Repeat the above steps, but remove those lines. IMPORTANT: DO NOT leave those lines in there. Remove them immediately after the site is up and running again
If there is no functions.php file in the theme: Create a new text file called “functions.php”. Edit it with notepad, and add this text to it, using your own URL instead of example.com:
update_option(‘siteurl’,’http://example.com/blog’);
update_option(‘home’,’http://example.com/blog’);
Upload that to your theme directory, then proceed as stated above. Remove the file afterwards. For more details and a few other methods, please follow the link below to the official WordPress support site. WordPress Support
WordPress is the perfect Content Management System for all your blog publishing and website management needs with one of AUSWEB’s cPanel Hosting plans.