Page 1 of 1

.htaccess mod rewrite help

Posted: Mon Jan 12, 2009 1:12 am
by paqman
Every forum and posting I've found online discussing mod rewrite basically says 'don't bother learning it - just cut and paste'. Only problem is that I really don't understand it and have a question. I've got this working on my site:

Code: Select all

RewriteRule ^(academic|drama)/([^/\.]+)/(.*) /test/department.php?department=$1&$2=$3
If I go to a url with only the first 2 variables (academic/test) it can't find the page, and I'm assuming this is because using my current rule is is looking for something with the third directory, otherwise it does not fall under the rule. I'm looking to add another variable, but before I do, is there any way to make a variable optional? That way I could just add onto this one, making the last one ($4) optional.

Thank you!