views:

72

answers:

2

hi, simple question, my url is

www.site.com/page--3

I need the rewriterule to read "/page--3" as two different values.

I have this working: RewriteRule ^/?([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)$ index.php?page=$1&subpage=$2

This gives me the values 'page' and '3' from www.site.com/page/3.

how do i get the rewriterule to read the '--' as a seperator for the values so that i can read the page and number values? Simply changing the / to -- does not work, does it need to be in some reg expression or escape value?

Any help appreciated

A: 

Hello,

I think this will work for u.

Best luck.

RewriteRule ^products/([0-9][0-9])/$ index.php?page--$1

Kanak Vaghela
hi kanakthe url will be www.site.com/page--pagenumberand then i'll take that format and get the vaulesso i need to figure out how to get the rewrite to give the the values correctly, so basically using your suggestion is going the wrong way from what i need.Firstly how does one specify the -- as the separator in the rule?Thank you for the response tho.
Eugene
A: 

Not sure if I understand you correctly, but assuming I do, this should work:

^/([a-zA-Z0-9-]+)(/|--)([a-zA-Z0-9-]+)$

It will match both www.site.com/page--3 and www.site.com/page/3. Note, though, that in difference from your original regex, $2 will be the separator and the values you're looking for are in $1 and $3.

nikc
thank you nikc,that is what i needed, new to expressions but learning quickly.I got the expression you gave me to work and just rewriting the rest of my rules to work along.
Eugene
Nice that you got it working. If you're on a PC, I've found Expresso (http://www.ultrapico.com/Expresso.htm) is quite invaluable when debugging regexes. (No affiliation.) One of the few reasons I still am on a PC :-)
nikc