当前位置: 代码迷 >> PHP >> .htaccess的伪静态规则
  详细解决方案

.htaccess的伪静态规则

热度:87   发布时间:2016-04-28 23:50:13.0
求一个.htaccess的伪静态规则
/index.php?mod=webdir&cid=10 伪静态成 /category/10-1.html
/index.php?mod=webdir&cid=10&page=2 伪静态成 /category/10-2.html
在.htaccess下应该怎么写呢,10是栏目ID,2是栏目列表分页

------解决方案--------------------
RewriteRule ^category\/([0-9]{1,})-1.html$ index.php?mod=webdir&cid=$1 [L]
RewriteRule ^category\/([0-9]{1,})-([0-9]{1,}).html$ index.php?mod=webdir&cid=$1&page=$2 [L]
------解决方案--------------------
^/category\/([0-9]+)\-([0-9]+)\.html$ index.php?mod=webdir&cid=$1&page=$2
------解决方案--------------------
^\/category\/([0-9]+)\-([0-9]+)\.html$ /index.php?mod=webdir&cid=$1&page=$2
  相关解决方案