php - Mod rewrite, for category and it's pages, conficts -


this question exact duplicate of:

i have category.php , has ?slug='something', looks after did code in .htaccess: www.example.com/category/football. , works well, need implement page numbering link this: www.example.com/category/football/page/2. did code in .htaccess, not work.

i wrote code in category.php indicate stuff:

echo "$_get['slug']"  if(isset($_get['page']))    echo $_get['page'] 

when go www.example.com/category/football it's ok, "fudbal" message echo $_get['slug']

but when go www.example.com/category/football/page/2 it's not ok, "fudbal/page/2" (i supose echoes it's slug) echo $_get['slug'] , $_get['page'] not give anything.

here .htaccess:

options -indexes rewriteengine on  rewriterule ^category/([a-za-z0-9-/]+)$ 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] 

try here: http://htaccess.madewithlove.be/ got error:

this rule met, new url http://www.example.com/themes/tema_2/category.php?slug=fudbal/page/2 tests stopped because l in rewriterule options

this should work you:

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

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -