[thesite] mod_rewrite trickery (was: What's appropriate for d.e.o.)

Simon Coggins ppxsjc1 at unix.ccc.nottingham.ac.uk
Fri Aug 17 10:55:14 CDT 2001


> > One other feature that's ready to add is "friendly" urls, but it needs
> > mod_rewrite installed before I can add it. Does anyone know if
> > mod_rewrite is installed and available using .htaccess files?
> 
> Oh, doing it with mod_rewrite? Interesting, how are you doing that
> then? I've got a little hand rolled function here for doing the same
> thing with $REQUEST_URI.

At the moment the subcategories are loaded using the url variable viewCat
which just passes the category ID. Instead of this:

http://dir.evolt.org/index.php?viewCat=30

I would like to show this:

http://dir.evolt.org/coding/client-side/css/

using mod_rewrite the actual location of the page would be:

http://dir.evolt.org/index.php?urlstring=coding/client-side/css/

I've written a function that will convert this url string back into a
catID, and another one to take a catID and create the url string (which is
used for building links).

Now you can do a similar thing using $PATH_INFO, or $REQUEST_URI but as
far as I know you would still need to include the filename like this:

http://dir.evolt.org/index.php/coding/client-side/css/

which I would like to avoid. I know you can fiddle with the types a bit to
get something a bit nicer like:

http://dir.evolt.org/directory/coding/client-side/css/

but I'd rather exclude that extra level all together if possible.

If you know of any way of doing what I'm trying to do with $REQUEST_URI
then that would be great!

Simon







More information about the thesite mailing list