Combine three rules in one

New to mod_rewrite? This is a good place to start.

Combine three rules in one

Postby Frozen Kiwi » Fri Feb 17, 2006 11:48 pm

I have three banal redirect rules:
Code: Select all
# matches
RewriteRule ^([^/]+)/([^/]+)/page([0-9]+)\.html$ index.php?category1=$1&category2=$2&page=$3 [NC,L]

# matches
RewriteRule ^([^/]+)/([^/]+)/$ index.php?category1=$1&category2=$2

# matches
RewriteRule ^([^/]+)/$ index.php?category1=$1

It works. But I suspect the rules are somewhat conflicting, let alone there must be more elegant solution. So here comes a simple question: is there a way to combine/simplify the above rules? I was messing around with the ^([^/]+)?/?([^/]+)?/?([^/]+)?/?$ syntaxes - to no avail. :( Any help is appreciated.
Frozen Kiwi
Posts: 1
Joined: Fri Feb 17, 2006 11:07 pm

Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 7 guests