Re: URL rewriting...anybody done this?
| From: | Jason Wong | Date: | Wed, 14 Jan 2004 19:04:43 +0000 |
| Subject: | Re: URL rewriting...anybody done this? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-174573@lists.php.net to get a copy of this message | ||
On Thursday 15 January 2004 02:44, Ryan A wrote:
> It seems to be partly working.
>
> /*
> How isn't it working? What happens? I would try one variable first, get
> that working, then add the others. Also, I am not sure how it will
> handle the space in "Beginners Corner". Try passing simple values first.
> */
> Its a bit hard to explain what happens so see for yourself:
> Heres the index page:
> http://www.rizkhan.net/articles/articles.php
> Heres the actual page:
>
> http://www.rizkhan.net/articles/show.php?category=Beginners%20Corner&sid=1&
>id=1 and then if you modify it to:
> http://www.rizkhan.net/articles/show/Beginners%20Corner/1/1
>
> it just shows me the index...which even links wrong.
>
> Ok, will try to pass a value without the space in between.
> > > RewriteRule ^show/(.*)/(.*)/(.*).php
> > > /show.php?category=Beginners%20Corner&sid=$2&id=$3
It doesn't look like your rule would match. Try:
RewriteRule ^show/(.*)/(.*)/(.*)
Another way to achieve a similar result without using Rewrite is to parse
$_SERVER['REQUEST_URI'], and possibly $_SERVER['PATH_INFO']
Eg if your link is:
http://www.rizkhan.net/articles/show.php/Beginners%20Corner/1/1
Then $_SERVER['REQUEST_URI'] would contain
/articles/show.php/Beginners%20Corner/1/1
and $_SERVER['PATH_INFO'] would contain
/Beginners%20Corner/1/1
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
You'd like to do it instantaneously, but that's too slow.
*/