Re: Reformatting the URI on return to the browser

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2007-06-14 at 09:59 -0400, Daniel Brown wrote:
> On 6/13/07, Robert Cummings <robert@xxxxxxxxxxxxx> wrote:
> > On Thu, 2007-06-14 at 12:17 +0900, Dave M G wrote:
> > > PHP,
> > >
> > > I've implemented "friendly urls" in my PHP scripts, so that people can
> > > type in things like:
> > > http://website.com/Cats And Dogs
> > > ... and they'll be taken to the right page.
> > >
> > > However, when they get to the page, the url will read:
> > > http://website.com/Cats%20And%20Dogs
> > >
> > > Not so pretty.
> > >
> > > I've noticed that Wikipedia will alter the URI to become more readable,
> > > by replacing the spaces with underscores, like so:
> > > http://wikipedia.org/wiki/Cats_And_Dogs
> > >
> > > I'd like to be able to do that with my system, but I can't quite figure
> > > out where in the process of getting a URI request and returning a page
> > > that the URI will get set.
> > >
> > > Can anyone help me with figuring out at what point I can gain control
> > > over the URI sent back, as Wikipedia does?
> >
> > If you're on a linux box you can use:
> >
> >     wget -S "http://en.wikipedia.org/wiki/scripting language"
> >
> > ... to see an example of what Wikipedia does.
> >
> > But to expound... :) Wikipedia issues a 301 (permanently moved) response
> > header (don't tell Richard Lynch ;) thus redirecting your browser to the
> > underscore version.
> >
> 
>     In tandem to Robert's post regarding the 301 (or 302, to be fair
> ;-P) HTTP response, you should also check into Apache's mod_rewrite.
> I still remember the quote by heart, but not who said it:
>         "Despite the tons of examples and docs, mod_rewrite is voodoo.
> Damned cool voodoo, but still voodoo."

                                     -- Brian Moore

It's from the mod_rewrite documentation:

    http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux