Redirect specific query to a page

António P. P. Almeida appa at
Sat Jan 19 01:51:59 UTC 2013

On 19 Jan 2013 02h21 CET, ondanomala_albertelli at wrote:

> I moved my website from Joomla to WordPress.. I'd like to redirect
> to (so, same domain).
> I tried with this line (both within the / location and outside it):
> rewrite /?option=com_content&view=article&id=164&Itemid=139
> /listituto/contatti/ permanent;

Try with a map. At the http level:

set $arg_str $arg_option$arg_view$arg_id$arg_itemid;

map $arg_str $redirect_contact {
    default 0;
    com_contentarticle164139 1;

Then do at the server (vhost) level:

if ($redirect_contact) {
    return 301 $scheme://$host/listituto/contatti;

Remember that the argument order can change and that your rewrite
already takes the arguments in consideration. You need to add a '?' at
the end of the replacement to omit the arguments from it.


--- appa

More information about the nginx mailing list