How to Install WordPress in a Subdirectory (and Serve It from the Root)

Readers often asked why our URLs include /archives/. In 2006 I didn’t want WordPress files cluttering the root folder, in case I later installed forums or a wiki, so I installed WordPress in quickonlinetips.com/archives/. If you want to install WordPress in a subdirectory too, there are two ways to do it. Here’s how each works in 2026.

Install WordPress in a subdirectory

Quick answer: To run your whole site at a subfolder address (example.com/blog/), simply install WordPress in that folder. To keep WordPress files in a subfolder but show the site at example.com, install it in the subfolder, set Site Address (URL) to the root in Settings > General, then copy index.php (and .htaccess) to the root and change the require line to point to the subfolder.

Option 1: Site lives at a subfolder URL

Your blog appears at example.com/blog/ and the root can hold something else (a landing page or another app).

  1. Create the folder (for example /blog/) in your hosting file manager.
  2. Install WordPress there with your host’s installer or manually.
  3. Both WordPress Address and Site Address will be https://example.com/blog.

Option 2: Files in a subfolder, site at the root

This is WordPress’s official “giving WordPress its own directory” method.

  1. Install WordPress in a subfolder, such as /wp/.
  2. In Settings > General, keep WordPress Address as https://example.com/wp and set Site Address to https://example.com. Save.
  3. Copy (don’t move) index.php and .htaccess from /wp/ to the root.
  4. Edit the root index.php: change require __DIR__ . '/wp-blog-header.php'; to require __DIR__ . '/wp/wp-blog-header.php';
  5. Go to Settings > Permalinks and click Save to refresh rules.

The login page stays at example.com/wp/wp-admin/. Full details are in the WordPress documentation.

Things to check

  • Take a backup before changing site addresses; a typo can lock you out.
  • Moving an existing site? Changing URLs needs 301 redirects and a search-replace of old links.
  • Caching and security plugins may need their paths updated.

Testing first? You can install WordPress locally and practise the setup safely.

FAQ

Is a subdirectory bad for SEO?

No. Google treats subfolder URLs normally. Pick one structure and keep it.

Can I move WordPress from a subfolder to the root later?

Yes, but URLs change, so set up 301 redirects from old addresses.

What if I get locked out after changing the Site Address?

Define WP_HOME and WP_SITEURL in wp-config.php to restore the correct addresses.

Stuck on a gift? Try our free Gift Idea GeneratorIdeas for anyone by age, job, interests and budget, with Amazon.com and Amazon.in linksFind gifts →

Found this useful? Share it with someone who needs it.

Get our free weekly email: new tech guides and tools, no spam.

New and updated tech guides, a free tool worth bookmarking and one useful pick, once a week. No spam, unsubscribe anytime.

One email a week. Unsubscribe anytime. See our privacy policy.

Related Tech Guides

Leave a Reply

Your email address will not be published. Required fields are marked *

2 Comments

  1. found this which may help too:

    http://www.mattvsworld.com/blog/2010/01/putting-wordpress-in-subdirectory-of-site/

  2. I can’t understand why you didn’t change WordPress URI and get this done. Since you have done it in this way, you have same content in,
    quickonlinetips.com/ and quickonlinetips.com/archives/

    Their is a handy way WordPress suggests to get this done without duplicate content or an addition to the URL. Here is the URL,
    https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory