php - URL rewriting with two parameters using .htaccess and Apache) -
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 second parameter "page"... when $_get['slug'] got this: fudbal/page/2 if url this: http://exmpl.com/category/fudbal/page/2.
so $_get['slug'] returns after category/ it's slug.
i need achieve this: when echo $_get['slug'] echo fudbal , when echo $_get['page'] echo 2.
you need tweak regex fix issue 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]
Comments
Post a Comment