You might not notice but there are two URLs of your site, including WordPress address and site address. The former indicates where WordPress admin pages, media, plugin, and theme files and folders are stored. The latter, meanwhile, refers to what visitors type on the browser to reach your website.
Still, there may be times when you want to update your WordPress URLs. A common reason comes to moving your site from HTTP to HTTPs. If you plan to use a new domain name, you also need to change your WordPress URLs.
In this article, we’ll give you tutorials on 5 different methods to update URLs in your WordPress site, depending on your tech skills.
Why You Should Change WordPress URLs?
It requires you to update your WordPress URLs for a couple of reasons.
- Move from HTTP to HTTPs – You’re recommended to use HTTPs for better site security. However, after making this significant change, you have to update your site URLs as well. The same thing goes for moving from www to non-www.
- Change domain name – Another case goes to updating your domain. You switch to another niche and the old one doesn’t suit your brand anymore. As a result, your site URL must be changed to reflect the update.
- Transfer to a subdomain – If you want to make the subdomain become your main site domain, you must update the WordPress address and site address.
- Create custom URLs for protected files – Do you protect your WordPress media files with the PDA plugin? Then, you have an option to change the private download links to make them more meaningful and memorable to users.
How to Change WordPress URLs
Below are 5 methods for you to update your WordPress URLs, including making changes in the admin dashboard, using the functions.php and wp-config.php file. Plus, you can use the PDA Gold plugin to change media URLs.
Method 1: Update WordPress URLs in Admin Area
WordPress provides a default setting that lets you change your site URL right in the admin dashboard. It just takes you a few clicks to complete this task.
After logging into your WordPress admin, simply go to Settings on the navigation menu. Then, open the General tab and you will see two options of WordPress Address (URL) and Site Address (URL). Replace the current URLs with the new one and you’re done.
Remember to save your changes. You should enter the new site URL on the browser to visit your site and make sure it still works probably. Plus, make sure that the new URL in WordPress Address and Site Address should be identical to each other. If not, it may cause the Too Many Redirects Error in WordPress, preventing you from accessing your site.
Method 2: Use Functions.php File
In case there is something wrong happens and you don’t have access to your WordPress admin, connect your site to an FTP client and edit the functions.php file.
Once opening the /wp-content/themes/your-theme-folder/, you’ll see a functions.php file in the Filename list. Right-click to edit it and add this code to the file:
update_option( 'siteurl', 'https://example.com' ); update_option( 'home', 'https://example.com' );
Similarly, replace the domain https://example.com with your website URL. That’s it!
Method 3: Use wp-config.php File
Bear in mind that information in the wp-config.php will override your WordPress general settings. Apply this solution when you can’t edit the WordPress Address and Site Address sections.
This file is located in the root folder of your website. To access and adjust the file, you need to connect to your site using an FTP client. Now open the wp-config.php file and enter the following code snippet there.
It requires you to replace the link https://myexamplesite.com with your website URLs.
The last step should be saving your updates and ensuring they work correctly on the live site.
Method 4: Use PDA Gold to Change URLs of WordPress Media Files
Apart from the website URLs, you also need to change the link of your WordPress images and documents. It helps prevent direct access from unauthorized users if they somehow have the links to your private and premium files.
The custom link allows specific users to view your images or PDFs only. Others, with the file’s original URLs, will be redirected to a 404 not found page.
To make use of the PDA Gold plugin, you first download then install it for your WordPress site by going to Plugins → Add New in your admin. Hit the Upload Plugin button at the top of the page and pick the plugin zip file you’ve just downloaded.
The next step comes to protecting your files and creating access links for them. You can go to Media → Library and find your desired file. Hover its name and click Protect to secure your file.
Open the protected file management popup by clicking on the Configure file protection option. To create custom links for your protected files, you can either auto-generate new random links or customize your links. You can generate as many private download links as you’d love to.
What makes users love this plugin so much is the ability to get the link expired by clicks or days. This means that they won’t be able to use the link to open the file after a few downloads or a certain day.
There are numerous other useful features that PDA Gold offer to comprehensively secure your files. Some of them are blocking search indexing, granting access to specific user roles, preventing image hotlinking, and encrypting protected files, etc. just to name a few.
Method 5: Change WordPress Login URL
WordPress provides one admin login URL for every site in the format of
Since everyone knows your login link, this is dangerous. Ill-intentioned users can take advantage of this issue, guess the confidential information, and access your admin area.
It’s recommended to change your site login URL for better security. This also helps stop WordPress user registration spam too. You have multiple ways to change the login URL, both using code and installing and plugin. Today, we’ll dig into the simpler solution, using the WPS Hide Login plugin.
The 4-step guide below will show you how to get started with the plugin.
- Go to Plugins → Add New in your admin
- Type “wps hide login” in the keyword box
- Install and activate the plugin
- Head to WPS Hide Login under Settings
- Enter the new login URL slug in the Login URL field
- Fill in the Redirection URL with a redirect URL when users attempt to log into your admin with the old link
Ready to Update WordPress URLs?
You can change your WordPress URLs, from the website domain to media file links or the admin login path.
We’ve walked you through 5 different methods to achieve them. You can update the links in the Settings section of your admin dashboard or technically edit the functions.php and wp-config.php files on the server.
PDA Gold proves a powerful plugin to protect your media and change their links to prevent direct access to the original URLs. It’s simple to install, set up, and get started with the plugin too.
WPS Hide Login, on the other hand, assists you in changing your admin login URL to strengthen site security.
Still have a question about changing WordPress URLs? Drop a line in the comment section to let us know and we can discuss together.