Mod-rewrite extensionless URLs with extension within directory separate from Wordpress install
<p>I am trying to help a nonprofit with their website that they recently moved to Wordpress but they have some legacy PHP pages that they still need. </p>

<p>I have migrated all of these pages over into a separate directory from WordPress; however, I am having issues with the URL rewriting.</p>

<p>They refer to these links without the .php extension (website.com/directory/page) and I cannot get the .htaccess mod-rewrite rules in the directory to add the .php extension so they will load and instead I get a 404 redirect. I want it to load website.com/directory/page/php.</p>

<p>I have tried several variations of the below .htaccess rewrite rules:</p>

<pre><code>RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php [L]
</code></pre>

<p>I think it may have something to do with the WordPress install and the rewrite rules associated with it; however, I thought that any .htaccess file in a directory took precedence.</p>

<p>I have searched and searched and tried every variation I could find and unfortunately I have only limited experience with regular expressions. </p>

<p>Maybe there is a problem a the vhost level? I either get a server error or a redirect. </p>