<div dir="ltr">Hello,<div><br></div><div><a href="http://nginx.org/en/docs/http/ngx_http_map_module.html">http://nginx.org/en/docs/http/ngx_http_map_module.html</a><br></div><div><span style="color:rgb(0,0,0);font-family:Georgia,serif;font-size:medium;text-align:justify;background-color:rgb(238,238,238)">Before version 0.9.0 only a single variable could be specified in the first parameter.</span><br>
</div><div><br></div><div style>map <span style="font-size:13px;color:rgb(80,0,80);font-family:arial,sans-serif">$arg_option$arg_view$arg_id$</span><span style="font-size:13px;color:rgb(80,0,80);font-family:arial,sans-serif">arg_itemid $redirect_uri {</span></div>
<div style><span style="font-size:13px;color:rgb(80,0,80);font-family:arial,sans-serif"> </span><span style="font-family:arial,sans-serif;font-size:13px">com_contentarticle40106 </span><span style="font-family:arial,sans-serif;font-size:13px">/blahblah/page1;</span></div>
<div style><span style="font-family:arial,sans-serif;font-size:13px"> </span><span style="font-family:arial,sans-serif;font-size:13px">com_contentarticle164139 /</span><span style="font-family:arial,sans-serif;font-size:13px">blahblah/page2;</span></div>
<div style><span style="font-size:13px;color:rgb(80,0,80);font-family:arial,sans-serif">}</span></div><div style><span style="font-size:13px;color:rgb(80,0,80);font-family:arial,sans-serif"><br></span></div><div style><font color="#500050" face="arial, sans-serif">...</font></div>
<div style><font color="#500050" face="arial, sans-serif"><br></font></div><div style><font color="#500050" face="arial, sans-serif">location / {</font></div><div style><font color="#500050" face="arial, sans-serif"> if ($redirect_uri) {</font></div>
<div style><font color="#500050" face="arial, sans-serif"> return 301 </font><span style="font-family:arial,sans-serif;font-size:13px">$scheme://$host$redirect_uri;</span></div><div style><font color="#500050" face="arial, sans-serif"> }</font></div>
<div style><font color="#500050" face="arial, sans-serif">}</font></div><div style><font color="#500050" face="arial, sans-serif"><br></font></div><div style><font color="#500050" face="arial, sans-serif">It's also order-independent. And this is an Orthodox way :)</font></div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/1/20 António P. P. Almeida <span dir="ltr"><<a href="mailto:appa@perusio.net" target="_blank">appa@perusio.net</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On 20 Jan 2013 02h28 CET, <a href="mailto:ondanomala_albertelli@yahoo.it">ondanomala_albertelli@yahoo.it</a> wrote:<br>
<br>
> I tried it but I get the error "nginx: [emerg] "set" directive is<br>
> not allowed here" (as you said I put set and map at http level and<br>
> rewrite at server level).<br>
><br>
<br>
</div>Indeed. set is not allowed at the http level, although it could be<br>
quite useful IMHO. Either that or allowing to combine variables as the<br>
left side of the map.<br>
<br>
You have to do a more complex mapping. Remove the set and use the<br>
following map instead (while mantaining the if at the server level):<br>
<br>
map $query_string $new_uri {<br>
option=com_content&view=category&id=40&Itemid=106 /blahblah/page1;<br>
option=com_content&view=article&id=164&Itemid=139 /blahblah/page2;<br>
## add as query string -> new uri lines as needed.<br>
}<br>
<br>
Now it depends on the order, which is bad. Other option is to use only<br>
set and if. Like this:<br>
<br>
At the server level:<br>
<div class="im"><br>
## String composed of all the arguments on the URI.<br>
set $arg_str $arg_option$arg_view$arg_id$arg_itemid;<br>
<br>
</div>if ($arg_str = com_contentarticle40106) {<br>
rewrite ^ $scheme://$host/blahblah/page1 permanent;<br>
}<br>
<br>
if ($arg_str = com_contentarticle164139) {<br>
rewrite ^ $scheme://$host/blahblah/page2 permanent;<br>
}<br>
<br>
Add as many if blocks as needed.<br>
<br>
It's ugly but since you have only a few redirects, it's manageable<br>
IMHO. Now you no longer depend on the order.<br>
<div class="HOEnZb"><div class="h5"><br>
--- appa<br>
<br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Best Regards,<br><div>Vadim Lazovskiy</div></div>
</div>