October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk10 min

How to Move a WordPress Install to a Subfolder Without Breaking Your Site

A careful guide to moving WordPress into a subfolder, whether visitors should keep using the root domain or the public URL should include the new directory.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

WordPress can live in a subfolder while visitors continue using the root domain. The safe method is to separate the WordPress Address (where the core files live) from the Site Address (the URL visitors use), back up the database and files, save the URL settings before moving anything, then repair the entry point, rewrites, and stored links.

Choose which URL arrangement you need

There are two supported end states. Decide between them before changing a setting, because the values in Settings > General, the location of index.php, and the rewrite configuration depend on that choice.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Decision point Core files in a subfolder, public site at the root Public site also under the subfolder
Example public URL https://example.com https://example.com/wordpress
WordPress Address (URL) https://example.com/wordpress https://example.com/wordpress
Site Address (URL) https://example.com https://example.com/wordpress
Root index.php Copy it to the web root and point it at the relocated bootstrap file. Keep the installation’s entry point with the installation.
Rewrite configuration Configure the root entry point and rules to send requests to the subfolder. Keep the rewrite configuration with the subfolder installation.
Redirect behavior Visitors continue to see root URLs; the subfolder is an implementation detail. Visitors see the subfolder in every public URL.
Stored URL replacement Replace links that still contain the old file location, while preserving root-facing links. Replace links so they consistently include the public subfolder.

The two fields are not interchangeable. WordPress Address identifies the directory containing the core files. Site Address identifies the address users type and the URLs WordPress publishes.

Prepare before changing anything

A relocation changes both filesystem paths and URLs. Do the preparation while the current site still works.

  • Back up the complete WordPress directory. Include core files, uploads, plugins, themes, and configuration files.
  • Export the database. Keep the database backup together with the file backup so you can restore a matching state.
  • Store the backups outside the directory being rearranged. A backup inside the folder you move can be accidentally moved, overwritten, or deleted.
  • Confirm access. Have working administrator credentials and FTP, SFTP, hosting-file-manager, or shell access before starting.
  • Record the current values. Note the existing WordPress Address, Site Address, permalink structure, PHP/server arrangement, and any custom rewrite rules.
  • Check wp-config.php. Look for WP_HOME or WP_SITEURL. These constants override database-stored addresses and can make the corresponding fields unavailable in the dashboard.
  • Plan a maintenance window. Saving new addresses can temporarily make the site or dashboard inaccessible until the files are in their new location.

Understand the URL settings

WordPress Address (URL)

This is the URL of the directory containing WordPress core. If the files will live in /wordpress, use https://example.com/wordpress here, including the correct scheme and hostname for the live site.

Site Address (URL)

This is the public URL visitors use. For a root-facing site, leave it at https://example.com. For a site that is intentionally moving under a subfolder, set it to https://example.com/wordpress.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Constants that override the dashboard

If wp-config.php defines WP_SITEURL or WP_HOME, those definitions take precedence over the values stored in the database. Change the constants deliberately, or remove them only if your deployment process no longer needs them. Do not expect the General Settings fields to change an address that is being forced by a constant.

Move WordPress into a subfolder while keeping the public site at the root

This is the usual choice when you want visitors to keep using https://example.com but want the WordPress files organized in /wordpress or another directory.

1. Create the destination directory

Under the web root, create the destination folder, such as wordpress or blog. If the WordPress package is not already on the server, upload the unzipped package contents into that directory through FTP or another supported file-transfer method. The directory should ultimately contain WordPress core files and directories, including wp-admin, wp-includes, and wp-content.

2. Save the two addresses before the physical move

  1. Sign in to the dashboard and open Settings > General.
  2. Set WordPress Address (URL) to the new subfolder URL, for example https://example.com/wordpress.
  3. Keep Site Address (URL) at the root, for example https://example.com.
  4. Save the changes once, then expect the current location to be temporarily inaccessible until the files and entry point match these values.

If constants override either field, update the relevant configuration first or use the constants as the authoritative values. Do not alternate between dashboard values and constants without deciding which system owns the setting.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

3. Move the core files and directories

Move the WordPress core files and directories into the new subfolder. Do not create a second copy of the database or install WordPress again; this is a filesystem relocation of the existing installation.

4. Copy the root entry point

Copy index.php from the new WordPress directory into the web root. Edit the copied root file so its bootstrap path points to the subfolder. A typical root entry point changes the required path from a file beside index.php to the relocated path, for example:

require __DIR__ . '/wordpress/wp-blog-header.php';

Use the actual folder name and preserve the rest of the file supplied by your WordPress version. The original index.php inside the installation remains part of the installation; the root copy is the public entry point.

5. Copy and adjust the rewrite file

For an Apache site, copy the installation’s .htaccess into the web root for the root-facing arrangement. The root rules must route requests through the relocated WordPress installation rather than assuming the files are beside the root entry point. Keep a copy of the original file so you can compare or restore it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Do not blindly combine rules from another site. Existing redirects, security rules, caching directives, and a host’s generated configuration can change the correct placement. If the server uses nginx or IIS, apply the equivalent documented server-block or web.config arrangement for a WordPress installation whose core directory is below the public root.

6. Check permissions and ownership

Moving files can change ownership or permissions, especially when using a hosting file manager. The web server must be able to read the PHP files and serve files in wp-content/uploads; it should not gain unnecessary write access to the whole installation. Correct ownership and permissions according to your host’s normal WordPress setup before diagnosing application errors.

7. Regenerate permalinks

  1. Open Settings > Permalinks.
  2. Leave the intended permalink structure selected.
  3. Click Save Changes, even if you did not alter the structure.

This forces WordPress to regenerate rewrite rules. If the page reports an inability to write the rewrite file, copy the generated rules into the appropriate server configuration using your host’s documented method, then save the permalink structure again.

8. Test the root-facing site

Test the home page, several existing posts, pages, category archives, search, the login page, and the dashboard. Confirm that the browser continues to show root URLs rather than unexpectedly exposing /wordpress. Check both a clean browser session and an authenticated session because cached redirects can hide a configuration error.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Move the public site under the subfolder

Choose this arrangement when the permanent public address should include the subfolder, such as https://example.com/blog.

1. Set both addresses to the subfolder

  1. Open Settings > General.
  2. Set WordPress Address (URL) to the subfolder URL.
  3. Set Site Address (URL) to the same subfolder URL.
  4. Save once, then complete the file move before attempting repeated logins.

2. Move the installation into place

Move the core files and directories into the destination folder. Keep the installation’s index.php and rewrite configuration there. Unlike the root-facing arrangement, you do not need a separate root entry point for normal requests to the subfolder.

3. Rebuild rewrites and test the new public path

After the files are in place, visit Settings > Permalinks and save the existing structure. Test the home page and content at the subfolder URL, then verify that old root URLs either redirect according to your intended policy or return the expected response. Update navigation, canonical URLs, feeds, and sitemap settings so they publish the subfolder address.

Repair old links, media, and generated URLs

Changing the installation directory does not automatically rewrite every URL stored in the database or inside post content. The migration guidance specifically warns that uploaded media links can continue pointing to the old folder.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Search the database and content for the old site URL and old directory path.
  • Update attachment URLs, image sources, enqueued CSS and JavaScript paths, menus, widgets, custom fields, and theme options.
  • Inspect canonical links, feeds, XML sitemaps, Open Graph metadata, and structured data.
  • Check that upload directories and newly uploaded files use the intended public path.
  • Use a migration or search-and-replace method that understands serialized data. A plain text replacement can corrupt serialized strings and break options, widgets, or plugin settings.
  • Take a fresh database backup immediately before any bulk replacement, and run a dry run or equivalent preview when your chosen tool supports one.

Replace only the obsolete value. For a root-facing site, do not turn every public URL into a subfolder URL merely because the core files now live there.

Server-specific rewrite considerations

Apache

Apache commonly uses .htaccess for WordPress rewrites. In the root-facing layout, the root file must send requests to the relocated installation, while the subfolder’s configuration must not create a competing or recursive rule set. Preserve unrelated host rules and verify that mod_rewrite and overrides are enabled.

nginx

nginx does not read .htaccess. The equivalent location and try_files directives belong in the server configuration, with the document root, script handling, and subfolder path aligned. Reload nginx only after validating the configuration, and keep a known-good configuration available for rollback.

IIS

IIS uses web.config and its URL Rewrite feature rather than Apache’s .htaccess. Ensure the rules target the selected public path and that PHP handling still reaches the relocated installation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The exact syntax depends on the server and existing rules. A syntactically valid rule in the wrong context can cause redirect loops, downloadable PHP, or site-wide 404 responses, so use the configuration format supported by your host.

Verification checklist after the move

Area What to verify What a failure usually indicates
Home page Loads at the intended public URL with correct CSS and JavaScript. Wrong address value, entry-point path, permissions, or rewrite target.
Posts and pages Existing permalinks return content, not 404 responses. Permalinks were not resaved or server rewrites do not match the layout.
Dashboard Login, media library, editor, and settings pages work. Cookies, redirects, constants, or mixed old URLs.
Media Old images load and a newly uploaded image displays. Database paths, upload URL settings, or file permissions still reference the old location.
Assets Theme CSS, JavaScript, fonts, and plugin assets load without 404 or mixed-content errors. Hard-coded paths or an HTTP/HTTPS mismatch.
SEO URLs Canonical links, feeds, and XML sitemaps use the intended public address. Generated URLs still use the previous Site Address.
Redirects Old addresses behave according to your plan without loops. Conflicting rules in root and subfolder configurations.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Common failures and fixes

The dashboard redirects repeatedly or will not open

Check that WordPress Address and Site Address match the chosen layout, then inspect WP_HOME and WP_SITEURL in wp-config.php. A constant with the old value overrides the dashboard. Clear browser cookies for the domain after correcting the values, because stale authentication cookies can preserve a redirect symptom.

The home page works but every post is a 404

Save the permalink structure again. Then verify the rewrite file or server block is in the location expected by your server. In the root-facing layout, confirm that the root rules point to the subfolder and that the copied root index.php references the correct directory.

Images are broken but the page text loads

Search for the old folder or domain in attachment metadata and post content, taking care with serialized values. Confirm that the uploads directory moved with the installation and that the web server can read it. Test one newly uploaded image to distinguish a database URL problem from a filesystem-permission problem.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

CSS or JavaScript files return 404 responses

Inspect the failing URL in the browser’s developer tools. A path that exposes the old installation directory usually comes from a hard-coded theme or plugin setting; a path that omits the new subfolder in the public-subfolder arrangement usually indicates stale Site Address data. Regenerate caches only after correcting the underlying URL.

The site shows a redirect loop

Look for contradictory rules in the root and subfolder rewrite files, an HTTP-to-HTTPS rule combined with an incorrect proxy setting, or constants that disagree with the dashboard values. Temporarily restore the last known-good rewrite configuration, then reintroduce only the rules required for the selected layout.

The General Settings fields cannot be edited

Inspect wp-config.php for WP_HOME and WP_SITEURL. Those constants intentionally override stored settings. Change the authoritative configuration rather than repeatedly editing fields that are being overridden.

RELOCATE was added during troubleshooting

Remove it after the address is corrected. WordPress warns that leaving RELOCATE enabled can allow an attacker to change the site URL in some configurations. It is not a permanent migration setting.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Rollback if the move fails

  1. Put the maintenance message or access restriction back in place if visitors are seeing errors.
  2. Restore the original files and database from the backups kept outside the rearranged directory.
  3. Restore the original index.php, .htaccess, nginx configuration, or web.config.
  4. Return WordPress Address and Site Address to their original values, including any authoritative constants.
  5. Test the original site before attempting another migration.

Do not mix a database from one URL state with files from another. The backup is most useful when the database, uploads, plugins, themes, and configuration represent the same moment.

Which arrangement should you use?

  • Use the root-facing arrangement when the domain already has established root URLs, bookmarks, inbound links, or marketing material and you want the filesystem reorganized without changing the public address.
  • Use the subfolder-facing arrangement when the subfolder is part of the intended information architecture and changing every public URL is acceptable.

In either case, the critical sequence is the same: back up files and database, decide the two addresses, save them before the move, relocate the files, align the entry point and rewrite configuration, refresh permalinks, repair stored URLs, test every important route, and remove temporary settings such as RELOCATE.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

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

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.