Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
VGSources
Blog

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

A practical guide to moving WordPress into /wordpress or another subfolder without breaking the public site, including URL settings, backups, root index.php and .htaccess handling, rewrites, database search-replace, validation, and rollback.
Length9 min Posted Quest giverVGSources Team

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.

You can put WordPress’s core files in /wordpress or another subfolder while keeping visitors at https://example.com. The safe method is to separate the WordPress Address (URL), which identifies the core-file location, from the Site Address (URL), which identifies the public site. Back up the files and database, set those addresses before moving anything, copy the root entry files when necessary, regenerate permalinks, and then repair any stored URLs that still reference the old path.

Choose the public URL before moving a file

WordPress supports two different layouts. Decide which one you need first; the correct file placement and URL values depend on this 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.
Arrangement Public URL WordPress Address (URL) Site Address (URL) Entry point and rewrites URL replacement work
Root-facing site https://example.com https://example.com/wordpress https://example.com Core files and rewrite configuration live in /wordpress. Copy index.php and .htaccess to the web root; the root index.php must load WordPress from /wordpress. Visitors keep the existing URLs, but database content, media, canonical links, feeds, or scripts can still contain the old installation path and must be checked.
Subfolder-facing site https://example.com/wordpress https://example.com/wordpress https://example.com/wordpress Keep the installation’s entry point and rewrite configuration with the files in the subfolder. The public URLs now include /wordpress. Links and references that previously pointed at the root may need to be changed to include the subfolder; redirects from old URLs may be required.

The two fields are deliberately separate. WordPress Address says where the application is installed; Site Address says where readers find the site. WordPress describes this flexibility in its migration documentation, but mixing the values or changing them after the move is the usual cause of a blank site, redirect loop, or missing assets.

Back up the complete installation

Do this before changing either URL. Keep the backup outside the directory you are about to rearrange so a file move cannot overwrite your only recovery copy.

  • Archive the entire WordPress directory, including wp-admin, wp-includes, wp-content, plugins, themes, and uploads.
  • Export the complete WordPress database, not only the options table.
  • Record the current document root, PHP version, database name, active theme, permalink structure, and server type (Apache, nginx, or IIS).
  • Save the current root index.php, .htaccess, nginx server block, or IIS web.config separately.
  • Confirm that you can download the backup and, if possible, test that the database export can be opened or restored.

A file-only backup cannot restore URL settings, posts, attachment metadata, or serialized plugin data. A database-only backup cannot restore themes, plugins, or uploaded files.

Create the destination subfolder

On an existing server installation

Create a directory directly under the web root, such as /wordpress or /blog. Its final web path should be predictable: a folder named blog under the document root normally becomes https://example.com/blog. Check ownership and permissions against the existing WordPress directory rather than making the new folder universally writable.

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

When WordPress is not on the server yet

Upload the unzipped WordPress package into the new folder using the host’s file manager or FTP/SFTP. Do not place a second copy inside the destination (for example, avoid accidentally creating /wordpress/wordpress). The package contents should be directly inside the target directory, with wp-admin, wp-includes, and wp-content at that level.

Set the URL values before the physical move

Root-facing layout

In the WordPress dashboard, open Settings > General. Set:

  • WordPress Address (URL): https://example.com/wordpress
  • Site Address (URL): https://example.com

Save the changes before moving the files. The dashboard can become temporarily inaccessible at this point because WordPress is now looking for its files in the new location; that is expected until the move and root entry point are in place.

Subfolder-facing layout

Set both fields to the final subfolder URL, for example:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • WordPress Address (URL): https://example.com/wordpress
  • Site Address (URL): https://example.com/wordpress

After the move, visitors will use URLs containing /wordpress. Existing root URLs do not automatically remain equivalent; plan redirects and link updates if the site has already been published.

If the dashboard fields are unavailable

Definitions in wp-config.php override the values stored in the database. When these constants exist, the corresponding fields in Settings > General are unavailable:

define( 'WP_HOME', 'https://example.com' );
define( 'WP_SITEURL', 'https://example.com/wordpress' );

Use the pair that matches your intended arrangement. Edit the existing definitions rather than adding competing definitions elsewhere in the file. Once the migration is stable, keep the constants only if you intentionally want the URLs locked in configuration; otherwise remove them and save the values through the dashboard.

Move the files into the subfolder

Root-facing site: copy the two root files

  1. Move the WordPress core directories and files into the destination, including wp-admin, wp-includes, wp-content, and the installation’s PHP files.
  2. From the moved installation, copy index.php and .htaccess into the web root. Do not delete the originals from the installation unless the server’s documented configuration specifically requires that layout.
  3. Edit the copied root index.php so its bootstrap path points to the subfolder. A typical root file for a folder named wordpress is:
<?php
/** Loads the WordPress environment and template */
require __DIR__ . '/wordpress/wp-blog-header.php';

If your destination is named blog, replace /wordpress/ with /blog/. Preserve the rest of the file unless your existing installation has a deliberate customization. The copy in the subfolder remains the installation’s own entry file; the root copy is the public front door.

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

Subfolder-facing site: keep the entry point with WordPress

Move the complete installation into the destination and leave its index.php and rewrite configuration there. Do not copy a second front controller to the root unless you also intend to serve the site from the root. A root-level index file left over from the old arrangement can send requests to the wrong bootstrap path.

Match the rewrite configuration to your server

Use the documented configuration for the server and the arrangement you selected. Apache commonly uses .htaccess; nginx uses a server-block configuration; IIS uses web.config. The important details are the request base and the filesystem location: a root-facing site must send root requests to the WordPress installation in the subfolder, while a subfolder-facing site must route requests under that subfolder.

  • For Apache, put the copied root .htaccess in the root-facing layout’s web root and retain the installation’s configuration in the subfolder as required by the WordPress setup.
  • For nginx, update the relevant location and try_files paths in the server block, then reload nginx using your host’s normal service procedure.
  • For IIS, place the rewrite rules in the location that receives the public requests and ensure the subfolder path is represented correctly.

Do not blindly combine root and subfolder rules from different layouts. A rule that is correct inside /wordpress can create a loop or prepend the folder twice when copied to the root.

Regenerate permalinks after the site loads

  1. Open the public homepage and one known post or page.
  2. Sign in to the dashboard at the URL appropriate to the new layout.
  3. Go to Settings > Permalinks.
  4. Leave the selected structure unchanged and click Save Changes.

Saving the screen rebuilds the rewrite rules for the active server integration. It does not rewrite old absolute URLs stored in posts or plugin settings, so complete the database and content checks below as a separate task.

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.

Repair stored paths, media, and generated URLs

The migration can be technically correct while content still points to the former location. Search for the old path in the database and in exported content, taking special care with serialized PHP data. A plain text replacement can corrupt serialized lengths and break widgets, theme settings, or plugin options.

Use a serialization-aware replacement method

  • Make a fresh database backup immediately before the replacement.
  • Search for the old base URL and, where relevant, the old installation path.
  • Use a migration or search-and-replace tool that understands serialized data, or run a carefully tested command-line/database procedure that does so.
  • Run a dry run or report first, review the affected tables, then perform the replacement.
  • Clear page caches, object caches, and CDN caches after the replacement.

For a root-facing site, public links may already be correct even though plugin settings or media metadata contain /wordpress. For a subfolder-facing site, references that formerly began at the root usually need the new subfolder included. Do not replace every occurrence of a word such as “wordpress” indiscriminately; target the exact old URL or path.

Check these outputs manually

  • Images, galleries, and downloadable media.
  • Theme CSS, JavaScript, fonts, and favicon files.
  • Canonical tags, pagination links, feeds, and XML sitemaps.
  • Login, password-reset, comment, and search forms.
  • Embedded video or iframe URLs and any hard-coded links in menus or widgets.

Validate the migration before declaring it finished

Test in a private browser window and, if possible, from a second network so cached redirects do not hide mistakes.

  • Load the homepage over HTTPS and confirm the browser stays on the intended public URL.
  • Open an old post, a page, an attachment, a category, a tag archive, and a search result.
  • Log in and log out; verify that the dashboard, media library, editor, and preview links work.
  • Inspect the page source or browser network panel for requests to the old folder, unexpected HTTP URLs, 404 responses, or repeated redirects.
  • Submit a test form and check that transactional email links use the correct base URL.
  • Review the canonical URL, feed address, robots output, and XML sitemap location.
  • Check server error logs for PHP include failures, permission errors, rewrite loops, and missing files.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot the common failure modes

The dashboard or homepage redirects repeatedly

Compare both URL fields character for character, including protocol, hostname, trailing slash policy, and subfolder. Check whether WP_HOME or WP_SITEURL in wp-config.php overrides the dashboard values. Then inspect the root and subfolder rewrite rules for a rule that adds the folder twice.

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

Every post returns a 404 but the homepage works

Save Settings > Permalinks again. If that does not help, verify that the server has the correct rewrite module or server-block rules and that the rule file is in the directory receiving the request. On nginx and IIS, changing a WordPress .htaccess file alone has no effect.

CSS, JavaScript, or images are missing

Inspect one failed request and note whether it contains the old folder, the folder twice, or an HTTP URL on an HTTPS site. Correct the stored URL using a serialization-aware method, then clear caches. Also verify that the moved files retained their ownership and readable permissions.

The site shows a database or “Error establishing a database connection” message

A file move does not normally change database credentials. Restore the previous wp-config.php from your backup or compare its database name, user, password, host, and table prefix with the original. Do not overwrite a working configuration with a fresh package copy.

You are locked out after saving the new addresses

Use the configured WP_HOME and WP_SITEURL constants temporarily, or correct the values directly in the database using your hosting control panel. Once you can sign in, remove temporary overrides if they are no longer needed and save the intended URLs in Settings > General.

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

Remove temporary migration settings and keep a rollback plan

Do not leave RELOCATE in wp-config.php. WordPress warns that, in some configurations, leaving it enabled can allow an attacker to change the site URL. Remove the line after recovery or migration work is complete.

Keep the old files and database backup until you have verified posts, media, forms, scheduled tasks, feeds, and search-engine-facing URLs. If the new arrangement fails, restore the original files, restore the database backup taken before the URL change, and return both address fields to their original values. Roll back as one coordinated operation; restoring only the files while leaving the new database URLs can produce the same redirect and missing-file symptoms.

Root-facing or subfolder-facing: which should you use?

Choose a root-facing site when

  • You want visitors and search engines to keep using the existing root URLs.
  • You want WordPress core files separated from other files in the web root.
  • You are prepared to maintain a root entry point and matching rewrite rules.

Choose a subfolder-facing site when

  • You want the installation’s physical and public paths to match.
  • Changing every public URL to include a subfolder is acceptable.
  • Your server or deployment process is easier to manage with the entire application under one directory.

Neither layout is inherently safer. The reliable choice is the one whose public URL, rewrite rules, deployment process, and stored links you can maintain consistently.

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.

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

Leave a Reply

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

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

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

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.