What is the best way to prevent the server allowing any variable for urls with a question mark. i.e. to stop things like domnain.com/?anythinguwant.html from being indexed. Thanks.
g1smd
9:02 pm on Jun 4, 2010 (gmt 0)
Do you want those requests redirected to the same URL path but without the appended parameters, or do you want to return a HTTP 404 status instead?
Or something else?
santapaws
9:17 pm on Jun 4, 2010 (gmt 0)
404 is what im looking to return. Thanks.
g1smd
9:34 pm on Jun 4, 2010 (gmt 0)
What have you tried?
It's likely two lines of code. One will be a RewriteCond looking at QUERY_STRING and matching "non blank", and the other will be a RewriteRule internally rewriting to a non-existent internal filepath and hence triggering the 404 ErrorDocument response. Round it all off with the [L] flag as usual.