How to Manage External Pages within WordPress

Let’s say you install WordPress in a subdirectory of your site, but you want to use it to manage specific pages in the root directory, as well. The ideal solution would be to move the entire WordPress installation into the root directory, but that may not always be feasible. As it turns out, you can use the following .htaccess code to accomplish the task without moving WordPress or changing any URLs:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} <em>existing-filename.php</em>
ReWriteRule . /<em>wordpress-directory</em>/<em>wordpress-nicename</em>/ [P,L]

The code above should go into the .htaccess file in your base directory, not in your WordPress directory. Change existing-filename.php to the relative file path of the file you’d like to manage from within WordPress, change wordpress-directory to the name of the directory where WordPress is installed, and change wordpress-nicename to the URL path of the page within WordPress that you’d like to substitute for the original.

Voila! Whatever you’ve got on the page within WordPress should now show up when users go to the original URL. Mesh your WordPress template with the rest of your site design and they won’t even realize the bait and switch.