I'm setting up a link tracking system, which (temporarily) involves adding /link/id/ in front of URL (like http://server/data/id/publication/id/).
rewrite data/id/(.*) http://server/$1;
The request is logged as:
ip - - [17/Nov/2011:10:07:19 +0300] "GET /data/id/publication/id.html HTTP/1.1" 302 154 "-" "UA"`
For some reason (keeping the compatibility with AWStats) it is wanted to have 200 logged instead of 302. (nginx allows to get 301 code out of box with permanent option, but thats inappropriate too)
What are my options here?
Will the combination of location { }
and rewrite
do the job?
UPDATE: AWstats is able to understand various status codes by setting ValidHTTPCodes="200 304 301"
, see this question; my problem is solved, but question is still active - any way to get rewrites working without 301/302 code?
Nginx is doing a client-side redirect because the redirect target has http:// in the URL - you can do a server side redirect (nginx will reread the new URL and send the file directly, with code 200) by just having
rewrite data/id/(.*) /$1;