I would like to add several custom WordPress rewrites to a directory that contains some special pages. I have added a directory named custom
, which contains all of the custom pages.
I have added rewrite rules, but for some reason whenever I try to access them, I get a 404 error. Here is a copy of my .htaccess
:
Options +FollowSymLinks
# BEGIN Custom
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /~meddept/
RewriteRule ^contact-us/? /~meddept/custom/contact.php [QSA,L]
</IfModule>
# END Custom
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /~meddept/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /~meddept/index.php [L]
</IfModule>
# END WordPress
The problem comes when trying to access contact-us/
. Visiting /custom/contact.php
also returns the same 404 error, even though the file definitely exists...
RewriteRule: http://82.147.22.3/~meddept/contact-us/
Direct file: http://82.147.22.3/~meddept/custom/contact.php
Can anyone explain why the first rule (with L
flag) is failing? I've tried with the numerous WordPress functions as well, but receive the same result...