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

.htaccess的伪静态规则

WBOY
Release: 2016-06-13 13:15:59
Original
828 people have browsed it

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template