destoon自定义伪静态规则和公司网址com/路径优化

一、先介绍如何自定义伪静态规则

1-1:先打开根目录 api/url.inc.php ,这个文件是存放全站伪静态规则的文件,我们先找到

 

  1. $urls['php']['list'][5] = array('example'=>'('.$L['url_rewrite'].') mulu-c1-2.html','index'=>'{$catdir}-c{$catid}-1.html', 'page'=>'{$catdir}-c{$catid}-{$page}.html');

 

在其下面一行新加

 

  1. $urls['php']['list'][6] = array('example'=>'('.$L['url_rewrite'].') c1-2.html','index'=>'c{$catid}.html', 'page'=>'c{$catid}-{$page}.html');

 

再找到

 

  1. $urls['php']['item'][4] = array('example'=>'('.$L['url_rewrite'].') show/1/','index'=>'show/{$itemid}/', 'page'=>'show/{$itemid}/{$page}/');

 

在其下面一行新加

 

  1. $urls['php']['item'][5] = array('example'=>'('.$L['url_rewrite'].') s5-2.html','index'=>'s{$itemid}.html', 'page'=>'s{$itemid}-{$page}.html');

 

这样 第一步就做好了,再来第二步

1-2:前提你的服务器支持根目录下的 .htaccess  伪静态规则,我们打开这个文件 在最后面新加

 

  1. RewriteRule ^(.*)s([0-9]+)([\-])?([0-9]+)?\.html$ $1/show.php?itemid=$2&page=$4
  2. RewriteRule ^(.*)c([0-9]+)([\-])?([0-9]+)?\.html$ $1/list.php?catid=$2&page=$4

自定义的规则就完工了

二、再介绍一下 默认的 公司网址伪静态 优化

2-1:DT默认的伪静态公司网址为 www.***.com/com/会员名 今天我们要把他优化一下 改成 www.***.com/s_会员名 这样的网址,便于SEO 和收录(当然 上面的 s_可以自己定义),首先,我们要找到原来默认的 com/ 的位置,打开

根目录 include/global.func.php 这个是全站的 公共函数文件 ,每次DT 更新都会更新,修改以后,每次升级请留意,打开后,我们找到 原

  1. $URL = DT_PATH.'com/'.$username.'/';

将其修改成

  1. $URL = DT_PATH.'s_'.$username.'/';

2-1:打开 根目录 .htaccess 文件 找到

  1. RewriteRule ^(com)/([a-z0-9_\-]+)/([a-z]+)/(.*)\.html$ index.php?homepage=$2&file=$3&rewrite=$4
  2. RewriteRule ^(com)/([a-z0-9_\-]+)/([a-z]+)([/])?$ index.php?homepage=$2&file=$3
  3. RewriteRule ^(com)/([a-z0-9_\-]+)([/])?$ index.php?homepage=$2

将其修改为

  1. RewriteRule ^(s_)([a-z0-9_\-]+)/([a-z]+)/(.*)\.html$ index.php?homepage=$2&file=$3&rewrite=$4
  2. RewriteRule ^(s_)([a-z0-9_\-]+)/([a-z]+)([/])?$ index.php?homepage=$2&file=$3
  3. RewriteRule ^(s_)([a-z0-9_\-]+)([/])?$ index.php?homepage=$2

所有的修改就完成了,现在就可以去网站后台选新的伪静态规则了,记得,先更新缓存,再选择伪静态规则,最后更新信息。

转自小黑:https://www.dtmuban.com/course/396.html

posted @ 2019-06-04 09:14  chinaifne  阅读(906)  评论(0编辑  收藏  举报