The Basic Situation
We have a server. It has some static files, some simple, "flat" .php
and .html
pages, but it also has a WordPress install at the document root, meaning that visiting /
takes the user to the WordPress site.
The static files are at /lp/
; however, I was recently tasked with rewriting the index of this folder as a WordPress page, such that its URL is preserved when accessed through WordPress. WordPress auto-adds the following lines to .htaccess
so that it handles any URLs that don't match existing files or folders:
# 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]
</IfModule>
# END WordPress
The Problem at Hand
The WordPress page at /lp/
is written and published and set up with the proper link, but now it needs to be accessed through WordPress instead of as a flat file. It would be fine and dandy for me to simply delete the content at /lp/
, but some of it needs to be preserved, ideally with the existing links intact save for the very specific /lp/
URL. Thusly, I created my own section above the WordPress section:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^lp/?$ /index.php [L]
</IfModule>
The problem is with this expression right here:
^lp/?$
This doesn't seem to work. It gives me the old page. This, however does work:
^lp/?
The issue with this fix is that using it redirects any URL beginning with lp/
, including those that might otherwise return flat or static content.
My Question
I figure there's something about the way WordPress or mod_rewrite
works that I'm missing... but what is it, exactly?
Feel free to let me know if there's additional information I should include.