Welcome! Log In Create A New Profile

Advanced

Re: Disable / ignore / redirect URLs with query strings to reduce blog spam

July 08, 2011 01:32PM
>>> Is it possible to disable / ignore / redirect all URLs
>>> with any query string? My site doesn't use query strings,
>>> and is suffering from blog spam links
>>> ...

>> server {
>> if ($args != '') {
>> return 301 $uri;
>
> This will not work for complex $uri which requires encoding.
>
>> # OR
>> # rewrite ^ $uri permanent;
>
> Correct rewrite would be
>
> rewrite ^(.*) $1? permanent;
>
> ($1 instead of $uri to make sure it will be properly escaped, and
> "?" to avoid query string append).

Thanks so much, Igor & Maxim!

I went with:

server {
... some earlier directives
if ($args != '') {
rewrite ^(.*) $1? permanent;
... more directives follow
}

and it works like a charm. Those blog spam links
will be gone in no time! Thank you!!

Sincerely,

Miles




_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

Disable / ignore / redirect URLs with query strings to reduce blog spam

miles July 08, 2011 05:18AM

Re: Disable / ignore / redirect URLs with query strings to reduce blog spam

Igor Sysoev July 08, 2011 06:48AM

Re: Disable / ignore / redirect URLs with query strings to reduce blog spam

Maxim Dounin July 08, 2011 09:08AM

Re: Disable / ignore / redirect URLs with query strings to reduce blog spam

miles July 08, 2011 01:32PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 123
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready