WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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