Redirect specific query to a page
António P. P. Almeida
appa at perusio.net
Sat Jan 19 17:57:53 UTC 2013
On 19 Jan 2013 15h44 CET, ondanomala_albertelli at yahoo.it wrote:
> Thanks Antonio for the reply! :)
>
> The fact is that I don't care so much about these redirects, I just
> want 4/5 pages of the old permalink structure to be correctly
> redirected to the new pages. This 4 page are (for example):
> /?option=com_content&view=category&id=40&Itemid=106
> /?option=com_content&view=article&id=164&Itemid=139
> /?option=com_content&view=article&id=288&Itemid=90
> /?option=com_content&view=category&layout=blog&id=1&Itemid=50
>
> All should be redirected to 4 different pages. Is there a way -
> without looking at parameters (I just need to redirect THOSE 4/5
> pages, not the whole perm structure) - to tell to singly redirect
> each to the corresponding new page (one line rewrite for each)?
>
> For example: /?option=com_content&view=category&id=40&Itemid=106 ->
> /blahblah/page1 /?option=com_content&view=article&id=164&Itemid=139
> -> /blahblah/page2
You could. Just use map to map the old on the new.
At the http level.
## String composed of all the arguments on the URI.
set $arg_str $arg_option$arg_view$arg_id$arg_itemid;
map $arg_str $new_uri {
default 0;
com_contentarticle40106 /blablah/page1;
com_contentarticle164139 /blablah/page2;
## add as many string -> new uri lines as needed.
}
then at the server level do:
if ($new_uri) {
rewrite ^ $scheme://$host$new_uri permanent;
}
Try it out.
--- appa
More information about the nginx
mailing list