Reputation: 81
I've found a few pages for redirecting a single page to 404 but it's not working. Here is my simple line
RedirectMatch 404 ^/showthread.php?p=3164554$
It does not work though. Am I missing something? Thanks!
Upvotes: 0
Views: 49
Reputation: 4069
Your configuration tries to redirect the page "404" to the page "^/showthread.php?p=3164554$" (see the documentation).
RedirectMatch
generates a redirection : you can't redirect with a HTTP 404 code. When redirecting, you may have issues with the query string (I couldn't match the query string), I would use rewrite rules :
You can redirect to a 404.html page with
RewriteEngine On
RewriteCond %{QUERY_STRING} p=3164554
# the empty question mark discard the query string
RewriteRule ^/showthread\.php 404.html? [L,R=301]
Or you can stay on the same url but show the 404 page :
RewriteEngine On
RewriteCond %{QUERY_STRING} p=3164554
RewriteRule ^/showthread\.php - [L,R=404]
Upvotes: 1
Reputation: 38502
Try this way to escape your .
character with \
like this.Let me know, it works for you or not.
RedirectMatch 404 ^/showthread\.php?p=3164554$
Upvotes: 0