没有使用所有参数的htaccess

I have a website with categories and I should pagination on those categories.

the first page of the category is:

http://www.domain.com/cat/category-name/

the others pages (with the pagination) should be like this:

http://www.domain.com/cat/category-name/2/

-> the number (2 for example) is the page number.

this is what I wrote on htaccess:

RewriteRule ^cat/(.*)/(.*)/$ cat.php?name=$1&page=$2 [L]

Thr problem is that if I write like this, I have to write a number.. and the main page of the category shouldn't be with number. what can I do?

Thank you.

(quite a naive solution)

You could use two RewriteRules :

  • The one you already have -- it'll match when there is a page number
  • And one without that page number