
Display your WordPress site from the root domain, installed in a subdirectory
Have you installed WordPress in a subdirectory like https://www.mywebsite.com/wp/
but want your site to be accessible directly from https://www.mywebsite.com/
? Don’t worry — there’s no need to move all the files or reinstall WordPress. In this article, I’ll show you how to do it safely and cleanly without breaking anything.
Why install WordPress in a subdirectory?
Many developers choose to install WordPress in a subdirectory (like /wp
) for organization, security, or simply convenience. But eventually, it becomes important for the site to load from the root domain (https://www.mywebsite.com
) for a more professional look, easier sharing, and better SEO.
Goal
We want to:
- Keep WordPress physically installed in
https://www.mywebsite.com/wp/
- But have the site load from
https://www.mywebsite.com/
as if it were in the root
Step-by-Step solution (without moving WordPress)
1. Log in to your WordPress admin
Go to: https://www.mywebsite.com/wp/wp-admin
2. Change the site URLs
In the admin dashboard, go to: Settings > General
Update the following fields:
- WordPress Address (URL):
https://www.mywebsite.com/wp
- Site Address (URL):
https://www.mywebsite.com
3. Copy files to the site root
From your /wp
directory, copy the following files to the root directory (/
):
index.php
.htaccess
(if it doesn’t exist yet, you can create it later)
Your file structure should now look like this:
/index.php /.htaccess /wp/ (WordPress stays here)
/wp
.
4. Edit the index.php file in the root
Open the index.php
file you just copied and find this line:
<?php require __DIR__ . '/wp-blog-header.php';
Replace it with:
<?php require __DIR__ . '/wp/wp-blog-header.php';
This tells WordPress to load from the /wp
folder.
5. Refresh permalinks
Go back to the admin area (/wp/wp-admin
) and navigate to: Settings > Permalinks
Just click Save Changes to regenerate the .htaccess
file.
Bonus: Redirect /wp to the root domain
To prevent visitors from accessing https://www.mywebsite.com/wp/
, add this redirection to your .htaccess
file:
RedirectMatch 301 ^/wp/?$ https://www.mywebsite.com/
This improves user experience and avoids duplicate content.
That’s it! Your site is now accessible from https://www.mywebsite.com/
while still running from the /wp
subdirectory. This is a clean, safe, and professional approach for keeping your WordPress installation organized without sacrificing your root domain URL.
This setup is perfect if you have other tools or files on your hosting and want to keep things tidy without compromising the look and feel of your main site.