[thelist] Mimicing a "normal" directory structure with mod_rewrite

Joshua Olson joshua at waetech.com
Sat Jul 9 09:26:05 CDT 2005

> -----Original Message-----
> From: April
> Sent: Saturday, July 09, 2005 5:51 AM
> I want to use mod_rewrite in a web directory so I can mimic a natural 
> directory structure like category/subcategory/subcategory/ while 
> overlaying one file like categories.php.  I'm fine just doing 
> category/, 
> but I can't figure out how to deal with the /'s between subcategories 
> and the fact that they might or might not be there.  IE I can do:
> RewriteRule ^dir/([A-Za-z]+)$ category_view.php?cat=$1
> but I can't figure out how to adjust it to deal with a url like:
> http://domain.com/dir/Games/Flash/Free


While this doesn't directly relate to mod_rewrite, I believe the syntax is
very similar.  So, perhaps this will help:


Swap out the ([\d]+) for ([A-Za-z]+) and you should be on the right track.

Also, be advised that if you add the ignore case flag then you could
simplify it to ([A-Z]+)

Joshua L. Olson
WAE Tech Inc.
Phone: 706.210.0168 
Fax: 413.812.4864

Monitor bandwidth usage on IIS6 in real-time:

More information about the thelist mailing list