mod_rewrite multiple parameters with regex (.*)

Question!

I have a url like the following:

http://www.example.com/cat/????/page/2/

As you can see there is Unicode string up there. I use the following directive in my htaccess:

RewriteRule ^cat/(.*)/page/([0-9]*)/$ cat.php?cat=$1&page=$2 [L,NC]

The problem here is the regex engine parses the url above and it sets all the ????/page/2/ as the first parameter while I only want the Unicode string as my first parameter and the integer as the second.

How can that be done? Is there a better way for finding Unicode characters other than (.*)?



Answers
That's a bit odd -- it should not behave like that -- must be Unicode messing the whole thing.

In any case -- use this instead -- it is more precise:

RewriteRule ^cat/([^/]+)/page/([0-9]+)/$ cat.php?cat=$1&page=$2 [L,NC]

You can replace [0-9] by \d -- does exactly the same and is shorter.

By : LazyOne


This video can help you solving your question :)
By: admin