Skip to content

Instantly share code, notes, and snippets.

@macedd
Last active October 19, 2015 12:25
Show Gist options
  • Save macedd/1e4b83809aa9cd89918f to your computer and use it in GitHub Desktop.
Save macedd/1e4b83809aa9cd89918f to your computer and use it in GitHub Desktop.
WordPress installed subfolder served in root
# BEGIN WP Admin
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^wp-admin/(.*)$ /site/wp-admin/$1 [QSA,L]
RewriteRule ^wp-(.*)$ /site/wp-$1 [QSA,L]
</IfModule>
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteRule ^site/index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /site/index.php [L]
</IfModule>
# END WordPress

When installing a new version of a site, often is best to keep old files intact and move the new installation to its subfolder.

This .htaccess, when placed in the root folder, rewrites to the subfolder all wordpress calls.

Assumes /site/ as the folder of installation. Please make sure to rename wordpress files from the root dir (wp-login, etc).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment