Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

A little help with mod_rewrite

is this possible?

12:21 pm on May 20, 2004 (gmt 0)

Junior Member

10+ Year Member

joined:Oct 17, 2003
votes: 0

Hi, I know a bit basics of mod_rewrite, but I am not sure about this.

www.domain.com/category/ will lead to category.php
www.domain.com/category/file/ will lead to file.php
www.domain.com/category/file/download will lead to download.php

Possible? Would appreciate for some advice. Thank you.

2:07 pm on May 20, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
votes: 0


Yes, it's possible, and easy using either mod_rewrite or mod_alias. Both of these methods use what's called a "back-reference" to identify, save, and then refer back to (copy) part of the requested URI when generating the new URI. Check out RedirectMatch [httpd.apache.org] and RewriteRule [httpd.apache.org] for more information, and look for the phrase "back-reference." You will also need to use regular expressions [etext.lib.virginia.edu] to define/match/extract/save the part of the requested URI you need to "copy" into the new URI. Then have a go at writing and testing the code [webmasterworld.com]. If it doesn't work, post your specific questions, and we'll have a look at them.