Skip to content

Instantly share code, notes, and snippets.

@Thomas-A-Reinert
Last active July 19, 2019 13:16
Show Gist options
  • Save Thomas-A-Reinert/fac70891a815c3a2b95be6615aabef51 to your computer and use it in GitHub Desktop.
Save Thomas-A-Reinert/fac70891a815c3a2b95be6615aabef51 to your computer and use it in GitHub Desktop.
WordPress 301 redirection from subdirectory installation to other subdirectory
# The following code will not only affect the subdirectory itself but all content within!
# Add it to the top of your .htaccess file BEFORE WordPress´ own rules, starting with "# BEGIN WordPress"
# Move from "old"-directory to "new" directory
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^old/(.*)$ /new/$1 [R=301,L]
</IfModule>
# In case you want to move from a subdir to the root-directory just remove the "new" from the second parameter like this:
# RewriteRule ^old/(.*)$ //$1 [R=301,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment