capture rewrite for every after question mark

token nginx-forum at
Wed Nov 30 17:06:25 UTC 2011


   I have found the following while searching it is the only one i can
get working with my config setup
   to send a 301 permanently if "/index.php" is directly accessed.

    if ($request_uri ~* ^(/home(/index)?|/index(.php)?)/?$)
    rewrite ^(.*)$ / permanent;

   GET 301 Moved Permanently
   GET  200 OK

   above works as expected.
   But, now if i have the following results as 200 OK as expected.  200 OK

   So how do you rewrite that if there is a question mark and or value
that follows "/index.php?" then returns 301.

   GET  301 Moved

   GET  200 OK

Posted at Nginx Forum:,219385,219385#msg-219385

More information about the nginx mailing list