站长网_站长创业_站长主页_站长之家_易采站长站

会员投稿 投稿指南 站长资讯通告: 修改PHPCMS头部标题标签{$head[title]}顺序
搜索:
您的位置: 主页 > 教程 > CMS > PHPcms > » 正文

PHPwind 伪静态简化URL长度为1.html,f2等的方法介绍

来源: 易采站长站

1。根目录下.htaccess(规则适用iis,其他nginx、apache还要稍做修改)
RewriteEngine on
RewriteRule f(\d+)_(.*)_(.*)$ /thread.php?fid=$1&page=$2&type=$3 [L]
RewriteRule f(\d+)_(.*)$ /thread.php?fid=$1&page=$2 [L]
RewriteRule f(\d+)$      /thread.php?fid=$1 [L]
RewriteRule (\d+)_(.*)_(.*)_(.*).html$ /read.php?tid=$1&page=$2&fpage=$3&uid=$4 [L]
RewriteRule (\d+)_(.*)_(.*).html$  /read.php?tid=$1&page=$2&fpage=$3 [L]
RewriteRule (\d+)_(.*).html$   /read.php?tid=$1&page=$2 [L]
RewriteRule (\d+).html   /read.php?tid=$1 [L]
RewriteRule ^(.*)-htm-(.*)$ $1.php?$2 [L]
RewriteRule /simple/([a-z0-9\_]+)\.html$ /simple/index\.php\?$1 [L]
2、在require/common.php
找到
function urlRewrite($url) {
换成:
function urlRewrite($url) {
global $db_htmifopen, $db_dir, $db_ext;
if (!$db_htmifopen) return $url;
     if (!preg_match('/^(http|ftp|telnet|mms|rtsp)|admin.php|rss.php/i', $url)){
         $add = strpos($url, '#') !== false ? substr($url, strpos($url, '#')) : '';
         if(strpos($url, 'thread.php?') !== false){
             unset($rw);
             $tharr = explode('&', substr(str_replace($add, '', $url), 11));
             foreach($tharr as $key => $value){
                 $ru = explode('=', $value, 3);
                 if($ru['1']){
                     switch($ru['0']){
                     case 'fid':
                         $rw['fid'] = $ru['1'];
                         $rw['para'] < 1 && $rw['para'] = 1;
                         break;
                     case 'page':
                         $rw['page'] = $ru['1'];
                         $rw['para'] < 2 && $rw['para'] = 2;

Tags:
最新图文资讯
1 2 3 4 5 6
相关文章列表:
易采站长站 - 联系我们 - 广告服务 - 友情链接 - 网站地图 - 版权声明 - 人才招聘 - 帮助 -