How to Change URL of WordPress Blog (in multisite)
-
Hey everyone!
So I just spent a couple days trying to change the URL of my wordpress blog. I’m sort of using the multisite, but each site is on a different database (I know, pretty pointless, but that’s just how it worked out for me best). I finally figured it out, but it took me a couple hundred tries doing many things in order to get it to work. So here is a list of the things I did to make it finally work. You may not need to do everything on this list, but when in doubt, try them all.
I just wanted to post this so hopefully no one else has to spend 3+ days trying to do the same thing.
Here’s what I did:
1. Change the wp-config.php file and add this code at the end:
define('WP_HOME','https://example.com'); define('WP_SITEURL','https://example.com');
Note: This is hard coding your blog; that means you won’t be able to edit this URL in your blog settings.
Don’t forget to change the “example.com” to your URL’s.
>>> WP_HOME refers to the link you want people to type in to go to your website i.e. https://yoursite.com
>>> WP_SITEURL refers to the link where your files actually are. This might need to be different for you. For example, if your files are in a subdirectory, this needs to be placed here. i.e. https://mainsite.com/yoursite
2. Change your database. Login to phpmyadmin and click your database on the left, click wp_options and then at the top of the page, click browse. Under the option_name, find siteurl. On the left, there’s an edit button. Click it, and change the url in the box that pops up to what you want people to type to get to your site, and then go to the bottom of the page and click go. Do NOT enter www. at the beginning, and include https://
NOTE: The “siteurl” is where your blog is actually located. You want to make sure it points to the place where your files are kept. For example, in a subdirectory, i.e. https://mainsite.com/yoursite
Then under the same wp_options heading, find home (by clicking the forward > arrow at the top or bottom of the page to scroll through). Do the same thing as above.
You might need to go through individual pages, and do a search for the old url without https:// and www. and change them to the new url.
For more info on this, go here: https://codex.www.ads-software.com/Changing_The_Site_URL#Changing_the_URL_directly_in_the_database
https://codex.www.ads-software.com/Changing_The_Site_URL#Multi-site_notes
3. Change the .htaccess file. I had to do this because I had changed the permalink settings for my blog/site. You might need to do this anyway.
This may be what you find in the file:
# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /yoursite RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /yoursite/index.php [L] </IfModule> # END WordPress
Take out the references to your old site (here “yoursite”) and change it to this:
# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress
Here’s more information on this:
https://codex.www.ads-software.com/Changing_The_Site_URL#Changing_the_.htaccess_file
4. What may also help is directing your domain name to your hosting account for your blog. In GoDaddy, if you have multiple databases/wordpress blogs/sites on one hosting account, you log in, go to hosting management, launch your hosting where your blogs are, and scroll down to settings > Domain Management (or click the Domains button at the top of the page, shortcut!), click “Add Domain” and follow the instructions. Include the path to where your blog/site’s files are located.
More info for GoDaddy users here:
https://support.godaddy.com/help/article/5399/hosting-multiple-websites-on-your-hosting-account
Doing this step first may help you get into your wp admin area if there’s a problem. Cant guarantee that, but it doesn’t hurt, either.
5. Also make sure all your DNS records and nameservers are pointed to the correct locations as well.
This worked for me, and I hope it helps.
Take care! ??
- The topic ‘How to Change URL of WordPress Blog (in multisite)’ is closed to new replies.