On Mar 25, 2014, at 12:12 , rahul286 wrote:
> Hi All,
>
> I am just wondering, say for 1000 url redirects, what will be more
> efficient.
>
> Rewrite Style:
> ============
> server {
> rewrite old-url-1 new-url-1 permanent;
> rewrite old-url-2 new-url-2 permanent;
> rewrite old-url-3 new-url-3 permanent;
> #....
> rewrite $old-url-1000 $new-url-1000 permanent;
> }
>
>
> Map Style:
> ============
>
> map $request_uri $new_uri {
> default $request_uri;
> old-url-1 new-url-1;
> old-url-2 new-url-2;
> old-url-3 new-url-3;
> #....
> old-url-1000 new-url-1000;
> }
>
> #and something like
> server {
> try_files $new_uri =404;
> }
>
> Since nginx is very fast, I am not able to notice any delay for around 20
> rewrites. :|
>
> Is one of above 2 method is recommended for large number of rewrites?
>
> I am inclined towards map, as rewrite adds plenty of notices logs. It's like
> every rewrite is checked for incoming requests unless it is surrounded by
> location.
>
> Please let me know if more details are needed.
location = old-url-1 { return 301 new-url-1; }
....
--
Igor Sysoev
http://nginx.com
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx