We frequently get tickets asking us to change the location of WordPress.
If you’re using the Softaculous auto installer it’s not hard to accidentally install WordPress in the /wp folder as that’s the default location.
Some people will simply delete the install and re-install leaving that parameter out:
If that’s not an option for you (i.e. you didn’t use Softaculous to install or you don’t want to remove it) there is a very easy fix to move WordPress.
Move The Location Of The Files
To get started with moving the location of your files, you simply need to login to cPanel -> File Manager:
Once inside, you’ll want to navigate to where the existing WordPress installation is.
Most of the time they’ll be somewhere inside of the public_html folder. If you left Softaculous defaulted to /wp, they’ll be in /public_html/wp:
To move them, you’ll click beside the top folder (wp-admin) and hold down the shift key and then click the last file in the list (notice how everything turns blue):
Once selected, you’ll drag them into the location you want, most of the time public_html.
This would look something like this:
Congratulations, at this time you’ve moved your WordPress files successfully!
How To Change The URL In The Database
Once the files are moved, you need to change the location inside the database.
This is so WordPress knows where the files are now located.
To do this, simply login to cPanel -> phpMyAdmin:
Once inside, you’ll click on your database name on the left:
As you can see, my database is called keydiets_wp123. If you only have one database this is easy, if you have multiple, you may need to open your wp-config.php file and confirm which database you’re using (use cPanel -> File Manager).
Once you have the correct database name, you’ll notice a table called options. You’ll select Browse beside it:
You will then see the siteurl and home in the option_name column.
Inside each of those, you’ll be able to click the URL and modify it accordingly.
When you click out, it’ll automatically save:
Once your URLs are set correctly, you’re finished:
Congratulations! Your files have been moved and your new URLs are set!
Generate A New .htaccess File
Finally, you need to have WordPress generate a fresh .htaccess file to ensure it picks up the changes.
To do this, simply navigate to your wp-admin and login (i.e. https://yourwebsite.com/wp-admin).
From the dashboard, hover over Settings -> Permalinks:
Once here, simply click Save Changes and it’ll automatically generate:
Congratulations! You’ve successfully changed your WordPress URL from inside the database!
How To Change Your WordPress URL
I’ve filmed a video tutorial where I walk through these steps for those that wish to follow-along:
Feel free to reach out to our Superhero Support team if you have any questions!
Ryan Gray is the founder and CEO of NameHero, one of the fastest growing independent web hosts in the United States. Ryan has been working online since 1998 and has over two-decades experience in Internet Entrepreneurship.
Sherman Sweeney says
Thank You, Mr. Ryan, It’s nice to watch a video and learn at the same time, At least I can do the work for me, and Customer. Thank You Very much and your Team I love Namehero. Someday I go and Visit everyone also bring Pizza.
Betsy says
Thank you for another helpful how-to article, Ryan & NameHero Team! I’ve been so impressed with your tutorials and knowledgebase. So glad I moved to NameHero!
Ryan Gray says
You are most welcome! Thank you for your business!