Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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

I need to rewrite a specific wordpress url to a 404 error:

?page_id=15 => 404

How can I match the query string? Apparently Apache doesn't feed that to the rewrite mod...

share|improve this question
mod_rewrite should be able to handle this OK. – w3dk Nov 4 '12 at 14:19
up vote 1 down vote accepted

Using mod_rewrite, you can match a query string using this:

RewriteCond %{QUERY_STRING} page_id=15
RewriteRule .* - [R=404]
share|improve this answer
Thank you very much! :-) – Fernando Nov 5 '12 at 22:36

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.