Geting feet wet with REGEX and url rewriting (maybe a bit 0T)
| From: | Ryan A | Date: | Thu, 04 May 2006 16:07:03 +0000 |
| Subject: | Geting feet wet with REGEX and url rewriting (maybe a bit 0T) | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-235528@lists.php.net to get a copy of this message | ||
Hey all,
Every now and then I start on using REGEXs and URL
rewriting as needed then stop again, this is one of
those times :-) I have a simple url rewite that goes
like this:
RewriteRule ^blog-([0-9]+).html$
index.php?act=blog&id=$1
and I send urls to the page like this:
mysite.com/blog/blog-2.html
which gets processed like this:
index.php?act=blog&id=$1
which works perfectly fine, now i would like to add
another parameter so the url looks something like
this:
mysite.com/blog/blog-2-the_great_escape.html
which should be processed like this:
index.php?act=blog&id=$1&string=$2
going through the regex tutoral I see I need to use
"$2" for the second parameter and "$3" etc if i keep
adding parameters but still getting stumped on the
first regex part (eg: ^blog-([0-9]+).html$ )
Thanks!
Ryan
------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)
-----
Fight back spam! Download the Blue Frog.
http://www.bluesecurity.com/register/s?user=bXVzaWNndTc%3D
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com