Heim >Backend-Entwicklung >PHP-Tutorial > .htaccess的伪静态规则
求一个.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