View Tutorial Metadata Edit Content Revision History Add New Tutorial Add to Watchlist Return 404 for URLs with parameters

Return 404 for URLs with parameters

It may be useful for SEO (something about duplicate content).

RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} . [NC]
RewriteRule .* - [r=404,L]

Tested on Apache2.

It will return 404 only if it is something after the "?" character.

It can be extended for other purpose to match only some of the parameters.

Talk icons discuss – in the article above, point your mouse over them to reply.
Can't find a relevant Talk icon for what you have to say? See how you can add one...
Note: All the talks and replies are also listed below.


Add a new discussion topic (Only if you don't find it above, duplicates will be removed)


Rating: (0+, 0-) No categories