Welcome! Log In Create A New Profile

Advanced

Re: Having trouble understand how rewrite works

António P. P. Almeida
October 19, 2011 08:22PM
On 19 Out 2011 17h51 WEST, noagbodjivictor@gmail.com wrote:

> Thanks again. I understand the map solution. Here's another issue,
> you see, the links below all map to the index page (there are other
> pages too, that have those PageID, ParentPageID, etc.. parameters).
>
> /index.cfm?PageID=1
> /index.cfm?resetCache=yes
> /index.cfm?PageID=1&ParentPageID=1&NavID=1
> /index.cfm?PageID=22&ParentPageID=1&NavID=22
> /index.cfm?PageID=14&ParentPageID=38&NavID=38&ReferringPage=1
>
> all map to / (index)

Taking the lead from Denis, try:

map $request_uri $is_old {
default 0;
~/index\.cfm\?PageId=\d+ 1;
~/index\.cfm\?PageID=\d+&ParentPageID=\d+&NavID=\d+ 1;
~/index\.cfm\?PageID=\d+&ParentPageID=\d+&NavID=\d+&ReferringPage=\d+ 1;
}

> /index.cfm?PageID=35&ParentPageID=26&NavID=26
> /index.cfm?PageID=35&ParentPageID=26&NavID=35&ProductID=8&PageText=off
> /index.cfm?PageID=35&ParentPageID=26&NavID=35&ProductID=9&PageText=off
> /index.cfm?PageID=35&ParentPageID=26&NavID=35&ProductID=10&PageText=off
> /index.cfm?PageID=35&ParentPageID=26&NavID=35&ProductID=15&PageText=off
> /index.cfm?PageID=35&ParentPageID=26&NavID=35&ProductID=16&PageText=off
> /index.cfm?PageID=35&ParentPageID=26&NavID=35&ProductID=11&PageText=off

map $request_uri $is_old_also {
default 0;
~/index\.cfm\?PageID=\d+&ParentPageID=\d+&NavID=\d+&ProductID=\d+&PageText=off 1;
}

Then you use the same type of if in location like exemplified by Denis
before. Just also a test for $is_old_also.

....

if ($is_old_also) {
return 301 <uri to new page here>;
}

> and these for example would map to another unique page.
>
> The parameters specify the actual page that must be mapped to. And
> since I now know I can't use regex on query parameters, is there a
> way to handle this situation?

See above. Try it.

--- appa

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Having trouble understand how rewrite works

victor October 19, 2011 11:54AM

Re: Having trouble understand how rewrite works

Denis F. Latypoff October 19, 2011 12:28PM

Re: Having trouble understand how rewrite works

victor October 19, 2011 12:34PM

Re: Having trouble understand how rewrite works

Denis F. Latypoff October 19, 2011 12:38PM

Re: Having trouble understand how rewrite works

victor October 19, 2011 01:10PM

Re: Having trouble understand how rewrite works

locojohn October 19, 2011 12:39PM

Re: Having trouble understand how rewrite works

locojohn October 19, 2011 12:40PM

Re: Having trouble understand how rewrite works

victor October 19, 2011 12:52PM

Re: Having trouble understand how rewrite works

António P. P. Almeida October 19, 2011 08:22PM

Re: Having trouble understand how rewrite works

victor October 19, 2011 12:52PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 277
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready