Page 1 of 1

Parse URL

Posted: Tue Feb 03, 2009 2:54 pm
by teezilla
Hello all.. I'm an intermediate php developer and I'm just having mental block kind of a day.

I'm just trying to parse_URL http://www.someurl.com/directory/214 for the last digits in the url and use them in a my sql db as the URL_ID. Also redirect that url to another page..

Any help would be greatly appreciated.

Thanks

TeeZilla :oops:

Re: Parse URL

Posted: Tue Feb 03, 2009 4:30 pm
by requinix
Sounds like you have some kind of URL rewriting going on. In which case, fix the rewriting scheme so that your PHP script gets the ID number directly.

Code: Select all

RewriteRule ^/?directory/(\d+)/?$ /directory/index.php?id=$1 [QSA]
index.php gets the ID with $_GET["id"].

Re: Parse URL

Posted: Tue Feb 03, 2009 4:36 pm
by teezilla
Thanks so much tasairis. I'll give that a try..