So I have a site currently located in a subdirectory, like so:

We are moving this site to a new server, and it will no longer be in a subdirectory. However, we need all the old URLs to still work, so for example if someone tries to go to, it will rewrite to

This seems like it should be simple. I’ve tried this:

RewriteEngine on
RewriteBase /
RewriteRule ^wp/(.*)$ /$1 [R=301,NC,L]

Which almost works, except it causes all the WordPress permalinks to 404 – so won’t be found even though it should be the correct URL. Does anyone know why this is happening?

Read more here: .htaccess – Removing a subdirectory from the URL


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: