I’d like to merge a wordpress and a legacy site together
while maintaining legacy urls. That is, if wordpress returns a 404, then check legacy directory and serve up if file exists.

I have the standard wordpress .htaccess:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress

If wordpress returns a 404, I’d like to see if the
file exists in “orig” directory and serve it up if so.

something like this (which doesn’t work):

# handle 404
RewriteCond %{ENV:REDIRECT_STATUS} 404
RewriteRule . /orig/%{REQUEST_FILENAME} [L]

Is this possible?

Read more here: wordpress htaccess to support legacy website on 404


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: