Are you looking for quick and easy ways to edit URLs on your site? We have the perfect guide for you. In this article, you’ll learn different ways to change the page URL in WordPress.
You may need to alter the URL of a page or post on your website at least once. This might be due to the URL being too long or confusing, or simply because you want to optimize it for search engines. Whatever the reason may be, we’ll guide you through the steps to edit the page URL address so you can improve the user experience.
But before that, let’s look at some more reasons why you might need to change the URL on your website.
Why change the URL of a WordPress page?
You might want to change the URL of a WordPress page for several different reasons. Some of the most common include:
- SEO optimization: Updating the URL of a page can help it rank higher in search engines. For example, if the original URL was too long or lacked important keywords, changing it to a shorter, more descriptive URL might increase the page’s exposure in search engine results pages.
- Rebranding: If your company or website has been renamed, you may need to alter the URLs of your pages to match the new brand identity.
- Website reconstruction: Your website may need certain changes and redesigning depending on the trends and needs of your website at some point. As a result, you will have to shift pages around and update the URLs of certain pages to reflect their new position in the site’s hierarchy.
- Fix broken links: When you update the title of a page or post, you must fix the broken links. The URLs may still show the old titles to the visitors when they try to reach the page from an external site or search engine results page. Hence, updating the URL can help you repair any broken links if there are any.
- Site migration: If you want to migrate an entire site to a new domain name, you may have to change the page URLs in your WordPress website.
Now that you know why you may want to edit URLs on your site, let’s see the different ways there are to do it.
How to change Page URL in WordPress
You can change the page URL in WordPress in different ways and from multiple areas of your website:
- From the Admin dashboard
- Editing the wp-config.php file
- From the WordPress database
- With WP-CLI
We’ll go through each method with a detailed guide in this tutorial.
1. Change Page URL from WordPress Admin Dashboard
You can edit the WordPress page URL from the admin dashboard. Here there are 2 options:
- Changing the URL of your domain
- Changing the URL of specific posts
1.1) Change the URL of your domain
To do this, log in to your website and go to Settings > General in your dashboard.
You will see various site options here. To change the URLs, head to the WordPress Address and the Site Address options. This will change the domain name of your website URL.
These two URLs are identical on most websites, so you’ll need to enter the new URL there.
However, there may be situations where these two URLs may be different. For example, let’s say you want to add a different URL for the home page of your website other than that of the WordPress directory. Then, you’ll have to add a different URL on the Site Address option.
Once you have made all the necessary changes to your website, click Save changes.
1.2) Change the URL of specific posts or pages
If you want to make a smaller change and simply edit the URL of a particular page or any other post type, you’ll have to do it individually. For this demonstration, we’ll change the WordPress URL of a webpage. Similarly, you can change it for other post types based on your needs. The steps are very similar for every post type.
First, go to Pages > All Pages in your WordPress dashboard. This will display all the pages of your website. Click on Edit on the page you want to change the URL.
You may be using a classic editor or the Gutenberg editor based on your website. Let’s see how you can change the page URL using each editor.
1.2.1) Change Page URL using Classic Editor
If you use the classic editor, you’ll see the permalink option just below the title of the page. Click Edit.
Then, it will allow you to change the path on your link for the particular web page. Once you enter the new URL here, click on Ok and Update the page to change the URL.
1.2.2) Change Page URL using Gutenberg Editor
On the other hand, if you use the Gutenberg editor, you can change your page URL from the page settings on the right sidebar. Just click on the link on the URL option.
This will let you change the URL of the page. Just enter the new URL path in the PERMALINK option. Finally, Update the page.
2. Edit the URL in WordPress from the wp-config.php file
In some cases, you may not have access to all the options on your WordPress admin dashboard. If that’s your case, you can change the URL of your website in WordPress using the wp-config.php file.
For this, you will have to connect your website using an FTP. You can use an FTP client like FileZilla or Cyberduck to connect your website to your hosting account. The required credentials will be provided by your web hosting service.
Once you connect your website with the FTP client, you need to locate the wp-config.php file on your website. It is usually found in the root folder of your website.
Then, open the file and add the following two lines of code above the line ‘That’s all, stop editing! Happy publishing.’
define( 'WP_HOME', 'http://yournewsiteurl.com' ); define( 'WP_SITEURL', 'http://yournewsiteurl.com' );
As you’ve already guessed, you have to enter your new site URL instead of “yournewsiteurl.com”. After you add these lines and make the necessary changes, save the file and close it.
Then, open your site again and check if the new URL has been changed on your website.
3. Change URL in WordPress from Database
If you’re not confident about editing the core files of your website, you can also use the WordPress database to change the URL. For this, you’ll need to access your phpMyAdmin dashboard from the cPanel.
Just log in to your cPanel account and click on phpMyAdmin under the database section. This will redirect you to your WordPress database in phpMyAdmin.
Now, search for the table of your website in the database and open it. Then, you have to select the wp_options table from where you can change your WordPress URL.
Here, double-click on the option_value column for the option_name ‘siteurl’ to edit the URL. Just enter the new URL here and change the URL for the option_name ‘home’ as well in the same way.
Your changes will be saved automatically after you deselect the URL fields. You will be able to see the changes as soon as you reload your website.
4. Change the WordPress Page URL with WP-CLI
Using WP-CLI commands is also one of the most efficient ways to change the page URL in WordPress. For this, you need coding knowledge, so it can be a good solution for developers or people that are comfortable using the command line terminal to make changes on their WordPress websites.
For this method, make sure you have SSH access and are familiar with accessing your WordPress website through WP-CLI before moving further.
In this approach, all you have to do is add the following pair of commands to replace your site URL.
wp option update home 'http://yournewsiteurl.com' wp option update siteurl 'http://yournewsiteurl.com'
That’s it! You’ll see the new site URL on your website after you preview it.
How to Prevent SEO Errors for new URLs
We’ve shown you some of the best ways to edit the page URL in WordPress. After you make that change, there are some more things to keep in mind to prevent SEO errors and site traffic loss.
- Use 301 redirects: You need to transfer traffic from the old URL to the new one by using 201 redirects after changing the URL. This ensures that search engines and people can still locate your material. So any links directing to your previous URL will continue to work without any issues and redirect them to the new URL.
- Update internal links: You must update any internal links that use the old URL on your site to point to the new URL format. This will keep your site accessible and easy to use for both site visitors and search engines.
- Update sitemaps and robots.txt: To reflect the new URL format, you need to ensure to update your sitemap and robots.txt files on your website. This will make it easier for search engines to crawl and index your site. You can even use one of the WordPress sitemap plugins if you need any help with it.
- Proper planning of site migration: Prepare an extensive checklist of all the procedures you must do, and double-check everything before making any adjustments to the existing URL.
- Carefully monitor your site: Maintain a careful check on your site’s performance in search rankings and traffic after the move. Keep an eye out for mistakes or problems and be ready to make additional modifications if required.
How to redirect visitors to new URLs
Most of the points mentioned in the precautions to prevent SEO errors after changing the site URL are pretty straightforward. But you need to pay serious attention to redirect your visitors to the new URL after you change it in your WordPress website, otherwise, the search engines and the users won’t be able to find your new link which may result in traffic loss.
So we will also show you a short guide to redirect a page to complete the process of changing the URL in WordPress. The easiest way to redirect a URL is by using a plugin.
We will be using the Redirection plugin for this demonstration. It is a free and lightweight redirection plugin that is very easy to use.
But if you want to browse some more plugins, you can have a look at our list of the best plugins to redirect a WordPress page. All of them are similar and the steps to use them are almost the same. For now, let’s start by installing the plugin.
1. Install and Set up the Plugin
Go to Plugins > Add New from your WordPress dashboard and search for the keywords of the plugin. After you see the plugin in the search results, click on Install Now to install the plugin.
The installation will take a few moments and then Activate the plugin.
If you want to use a plugin that is not included in the WordPress plugin repository, you’ll have to upload and install them manually. Have a look at our tutorial on how to install a WordPress plugin manually for more details on it.
After the plugin is activated, open the Tools > Redirection menu on your WordPress dashboard. Then, you’ll need to set up the plugin by clicking on Start Setup. You just need to adjust the basic setup and the rest API options to complete the setup.
Click Finish Setup once you make all the necessary changes.
2. Redirect to New URL
Now, you can start adding redirections for your new URL. Since we have changed the domain name of the whole site, we’ll need to relocate the URL of the entire WordPress website.
Open the Site tab and enter the new site URL on the Relocate to domain option. After that, you can further change the HTTP headers option for the redirect if required.
Then, click on Update to save your changes. It may take some time to complete the redirection for the site migration. But make sure that you check if the redirection works on your website after the process is completed.
But if you have changed the URL of an individual page and want to redirect the particular page or post, please have a look at our guide to redirect a WordPress page. We have a detailed tutorial on how to add redirects for individual WordPress pages there.
Bonus: How to change WordPress Login Page URL
Even if you redirect your entire website after the site migration, the WordPress login page URL might still be the same. So you will still need to change it individually. It’s a bit tricky to change the login page URL in WordPress.
This is why we have included this quick bonus tutorial in case you want to change the login URL too. The WordPress login page URL can be easily modified using a plugin.
All you have to do is install and activate WPS Hide Login or any similar plugin to your WordPress website. You can follow the exact installation steps mentioned above for the Redirection plugin.
Then, go to Settings > WPS Hide Login from your WordPress dashboard to access the plugin settings.
Here, you will be able two see two options named login URL and redirection URL. You need to add your new login path on the Login url option.
But if a user tries to access your old login URL, you can also redirect them to a 404 error redirect to keep your website secure. Just enter 404 on the Redirection url option for this and click on Save changes.
Now, test your new login URL on your browser and log in to your WordPress dashboard.
If you want to customize your login page some more, you can also check out our well-explained tutorial on how to change WordPress login page URL.
Conclusion
These are all the various ways to change the page URL in WordPress. As you can see, changing the page URL in WordPress is a simple process that can be accomplished in just a few steps.
To summarize, there are four ways you can change the URL of your WordPress website:
- Admin dashboard
- wp-config.php file
- WordPress database
- With WP-CLI
All of these methods work quite well even though the WP-CLI approach is a bit technical. However, you can use other approaches to change the URLs even if you are a beginner user of WordPress.
Additionally, we’ve also included some tips to prevent SEO errors after changing the URLs on your website. So remember to redirect the old URL to the new one to avoid losing any traffic or link juice. With these tips, you can easily update your page URLs and improve your website’s overall performance.
We hope that you can easily change URLs on your WordPress website now. Do let us know how did it go in the comments below.
If you want some more helpful guides to improve your WordPress website, feel free to go through the following posts:
is Redirecting old one to new url can cause problem?