I need to rewrite a specific WordPress URL to a 404 error:

?page_id=15 to 404

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


1 Answer 1


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

RewriteCond %{QUERY_STRING} page_id=15
RewriteRule .* - [R=404]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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