.htaccess mod rewrite help

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
User avatar
paqman
Forum Contributor
Posts: 125
Joined: Sun Nov 14, 2004 7:41 pm
Location: Burnaby, BC, Canada

.htaccess mod rewrite help

Post 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!
Post Reply