This is the automatically generated htaccess file of WP using permalinks for the pattern /%year%/%postname%/ (working with http://localhost/BLOG-FOLDER/ yet):

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /BLOG-FOLDER/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /BLOG-FOLDER/index.php [L]

Now the problem is that the rewrite rule applies for http://localhost/BLOG-FOLDER/this-file-does-not-exist, too, and not only for "correct permalinks" such as http://localhost/2012/My-first-entry/.

So, what are the modifications of my htaccess file to get this work?

Thanks a lot! Carlos

  • Your question is very vague and does not explain exactly what you are trying to accomplish. Give us examples, what do you want it to do if the page doesn't exist? What about if the page does exist? – Jared Jan 19 '12 at 12:30

The web server doesn’t know if a request URI matches a valid permalink.

Handling 404 errors happens in WordPress itself. Your theme should have a 404.php file to return properly formatted output.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.