0

I am trying to force Nginx to redirect/rewrite one URL that uses a query string /?cat=20 to /category/lighttpd/. Here is what I tried, which is not working:

location ~ /\?cat=20 {
    rewrite ^ http://kevinworthington.com/category/lighttpd/? permanent;
}

I first tried the first line as:

location ~ /?cat=20 {

but that didn't work for me either.

This is using WordPress as the CMS, if that makes any difference.

Your help or tips are appreciated. Thanks.

Kevin Worthington
  • 327
  • 2
  • 6
  • 19

1 Answers1

1

Just an example ...

location / {
    if ($arg_cat = "20") {
        return 301 http://kevinworthington.com/category/lighttpd/?;
    }
    # blablabla
}
cadmi
  • 7,308
  • 1
  • 17
  • 23