Reputation: 2112
I have WP site with redirects setup as follows :
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule . /index.php [L]
</IfModule>
Which works fine for all URLs. But if i access a url like "/file/does/not/exist.php" it shows a WP 404 error page. I dont want that request to reach WP, it should show a 404 from apache.
So "/file/does/not/exist" should go to WP 404 page (it does) but "/file/does/not/exist.php" should be a 404 from Apache.
Upvotes: 0
Views: 320
Reputation: 360842
That kind of conflicts with the !-f
RewriteCond ("not a file"). A missing script is not a file, therefore it satisifies the rewrite condition. You may have to specifically check if the filename contains '.php' and not rewrite to wordpress. But what if someone tries to access some other file extension which should also be a 404?
Upvotes: 1