登录|使用QQ帐号登录
论坛首页 > 程序技术
发帖|
看12411|回3|收藏
xuanp 看全部
2017-5-9 16:53:25
一、Apache规则:

引用:

<IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteCond %{QUERY_STRING} ^(.*)$
        RewriteRule ^(.*)/list-([0-9]+)-([0-9]+)\.html$ $1/index.php?v=listing&cid=$2&page=$3&%1
RewriteCond %{QUERY_STRING} ^(.*)$
        RewriteRule ^(.*)/item-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/index.php?v=show&cid=$2&id=$3&page=$3&%1
        RewriteCond %{QUERY_STRING} ^(.*)$
        RewriteRule ^(.*)/show-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/index.php?v=show&cid=$2&id=$3&page=$3&%1
</IfModule>
<VirtualHost *:80>
DocumentRoot D:/www
ServerName localhost
RewriteEngine on
#规则放在下面即可
</VirtualHost>

二、.htaccess 文件

引用:

RewriteEngine on
RewriteRule ^item-([0-9]+)-([0-9]+)-([0-9]+).html index.php?v=show&cid=$1&id=$2&page=$3
RewriteRule ^show-([0-9]+)-([0-9]+)-([0-9]+).html index.php?v=show&cid=$1&id=$2&page=$3
RewriteRule ^list-([0-9]+)-([0-9]+).html index.php?v=listing&cid=$1&page=$2
RewriteRule ^tuan/([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+).html index.php?f=tuan&v=init&cid=$1&price=$2&order=$3&page=$4



xuanp 看全部
2017-5-9 16:54:47
Apache规则和.htaccess 文件规则是不一样的
xuanp 看全部
2017-5-9 16:57:18
建议把伪静态规则写好一点   最好能够写成  http://localhost/news/(栏目页)   http://localhost/news/id/(文章页)这种类型
xuanp 看全部
2017-5-9 16:57:41
怎么新建栏目  
默认设置成伪静态

绵阳网站建设

Powered by Discuz! X3.4

首页|标准版|触屏版|电脑版