I need to rewrite those url:
rewrite /shop.php?category=catergory1 http://example.com/c123 permanent;
rewrite /shop.php?category=category2 http://example.com/c234 permanent;
but get "No input file specified" instead of redirecting.
how i should properly write those ?
p.s. i have about one hundred of links like
^/shop.php?category=camp&subcategory=&showitem=26
^/shop.php?category=stove&subcategory=&showitem=14
and need redirect all of them into 2 different urls - all category=camp to /url1 and all category=stove to /url2 i dont need all of the parameters other than first one in base url.
p.p.s i should do about 2 thousand permanent redirects for my project. could the processing of this redirects be reduce nginx working speed ?
Regarding your p.s. this configuration should work for you. Matching the query directly in the rewrite won't work.
location /shop.php {
if ($args ~* "/?category=camp") {
rewrite ^ http://example.com/url1? permanent;
}
if ($args ~* "/?category=stove") {
rewrite ^ http://example.com/url2? permanent;
}
}
The question mark after "url1" is used to remove the query from the old url.
I'm not quite sure about the performance of that many redirects, however the answers to this question contain some information about that fact.