使用.htaccess和Apache重写两个参数的URL

I have below code in .htaccess:

Options -Indexes

RewriteEngine on

RewriteRule ^category/([a-zA-Z0-9-/]+)/page/([0-9]+)/{0,1}$ themes/tema_2/category.php?slug=$1&page=$2 [NC,L,QSA]

I have problem with second parameter "page"... When I do $_GET['slug'] i got something like this: fudbal/page/2 if my url is like this: http://exmpl.com/category/fudbal/page/2.

So $_GET['slug'] returns all after category/ like it's slug.

I need to achieve this: When I echo $_GET['slug'] to echo fudbal and When I echo $_GET['page'] to echo 2.

You need to tweak your regex to fix your issue like this:

Options -Indexes
RewriteEngine on

RewriteRule ^category/([^/]+)/?$ themes/tema_2/category.php?slug=$1 [NC,L,QSA]
RewriteRule ^category/([^/]+)/page/(\d+)/?$ themes/tema_2/category.php?slug=$1&page=$2 [NC,L,QSA]