Home  >  Article  >  Backend Development  >  .htaccess的伪静态规则

.htaccess的伪静态规则

WBOY
WBOYOriginal
2016-06-13 10:46:25869browse

求一个.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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn