URL rewriting with two parameters using .htaccess and Apache

前端 未结 1 1090
没有蜡笔的小新
没有蜡笔的小新 2021-01-29 02:41

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条回答
  • 2021-01-29 02:45

    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]
    
    0 讨论(0)
提交回复
热议问题