This forum has been moved here:
Helicon Tech Community Forum

ISAPI_Rewrite 3.0 (Forum Locked Forum Locked)
 Helicon Tech : ISAPI_Rewrite 3.0
Subject Topic: Looping
Author
Message |
V8S
Newbie


Joined: 08 November 2011
Posts: 2
Posted: 08 November 2011 at 4:41am

I cannot figure this out and hope that someone can help please.

I have some landing pages called:

/london/properties.asp
/paris/properties.asp
/new-york/properties.asp

They are run from a template, and I need to capture the london place variable from the URL and give this to the page in order to serve up the correct information each time.

The page it serves to is:

/template.asp?key=

So I have a working rule, thus:

RewriteRule ^(.*)/properties.asp /template.asp?key=$1 [NC,L]

However, on each page there are options to change page, sort, restrict by price range, type of property and location. This is where I run into problems with understanding looping.

The URL of the page might look like this when someone refines their search or changes page number:

/london/PageNo/3/Sort/DESC/Type/Apartment/Budget/250000-500000/properties.asp
e.g. /template.asp?key=london&PageNo=3&Sort=DESC&Type=Apartment&Budget=250000-500000

or

/london/PageNo/3/properties.asp
e.g. /template.asp?key=london&PageNo=3

or

/london/Sort/ASC/Type/Apartment/properties.asp
e.g. /template.asp?key=london&Sort=ASC&Type=Apartment


So, I need to loop everything after the first variable to tell the template page what to display.

This is as far as I have got, but, as I'm not really understanding Regular Expressions yet, I've got myself in a bit of a hole.

RewriteRule ^(.*)(\?[^/]*)?/([^/]*)/([^/]*)(.*)/properties\.asp /template.asp?key=$1(?2$2&:\?)$3=$4$5 [NS,I]

Most of this is taken from Helicon's example page.

Can anyone help please??


Edited by V8S - 08 November 2011 at 4:42am
Back to Top
 
V8S
Newbie


Joined: 08 November 2011
Posts: 2
Posted: 09 November 2011 at 4:16am

Anyone?

I really need some help if possible.
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 11 November 2011 at 5:47am

Hello,


To start with:
- in case you want to match everything between '/' and '/' use ([^/]+);
- please, try using '$' as the end of the pattern and try escaping '.' as in following:

RewriteRule ^([^/]+)/properties\.asp$ /template.asp?key=$1 [NC,L]
RewriteRule ^([^/]+)/PageNo/(\d+)/properties\.asp$ /template.asp?key=$1&PageNo=$2 [NC,L]

Regards
Andrew
Back to Top
 

Sorry, you can NOT post a reply.
This forum has been locked by a forum administrator.

Printable version Printable version