时时商务社区

标题: dedecms伪静态设置以及目录链接301跳转实现方法(伪静态) [打印本页]

作者: yj1281    时间: 2018-2-13 20:38

htaccess伪静态的规则
通过htaccess使用伪静态,则必须空间商支持Rewrite模块,该模块负责URL的重写。否则即便是设置好了,也无法使用,并且还有可能出现500错误。
下面是dedecms的伪静态设置文本(部分参考):
个性化伪静态还需要配合修改dedecms后台文件才能实现
效果为www.***.com/plus/view.php?aid=123转化为www.***.com/html/123/123.html
具体规则大家可以根据自己的需要进行修改!
RewriteEngine On  
RewriteRule ^category/list-([0-9]+)\.html$ /plus/list.php?tid=$1  
RewriteRule ^category/list-([0-9]+)-([0-9]+)-([0-9]+)\.html$ /plus/list.php?tid=$1&totalresult=$2&ageNo=$3  
RewriteRule ^archives/view-([0-9]+)-([0-9]+)\.html$ /plus/view.php?arcID=$1&pageno=$2  
RewriteRule ^plus/list-([0-9]+).html$ /plus/list.php?tid=$1   
RewriteRule ^plus/list-([0-9]+)-([0-9]+)-([0-9]+).html$ /plus/list.php?tid=$1&totalresult=$2&ageNo=$3   
RewriteRule ^plus/view-([0-9]+)-1.html$ /plus/view.php?arcID=$1   
RewriteRule ^plus/view-([0-9]+)-([0-9]+).html$ /plus/view.php?aid=$1&pageno=$2  //个性化伪静态文章链接  
RewriteRule ^list_([0-9]+)-([0-9]+)-([0-9]+).html$ list.php?tid=$1&TotalResult=$2&ageNo=$3  
RewriteRule ^html/([0-9]+)([0-9]+)/([0-9]+).html$ /plus/view.php?aid=$3
5.目录和文章链接的301跳转
该功能可以实现网站目录链接和文章链接的301跳转
RewriteEngine On  
RewriteBase /  
RewriteRule ^html/it/(.+)$ https://www.***.com/html/$1 [R=301,L]
效果是:访问www.***.com/html/it/*.html 会跳转到www.***.com/html/.html 这个上面





欢迎光临 时时商务社区 (http://bbs.4435.cn/) Powered by Discuz! X3.2