2000字范文,分享全网优秀范文,学习好帮手!
2000字范文 > php伪静态规则生成 SEO工具箱:PHP自动生成PHPCMS伪静态规则.htaccess

php伪静态规则生成 SEO工具箱:PHP自动生成PHPCMS伪静态规则.htaccess

时间:2024-02-22 09:33:09

相关推荐

php伪静态规则生成 SEO工具箱:PHP自动生成PHPCMS伪静态规则.htaccess

define(‘PHPCMS_PATH‘, dirname(__FILE__).DIRECTORY_SEPARATOR);include PHPCMS_PATH.‘/phpcms/base.php‘;//pc_base::creat_app();

$db_config = pc_base::load_config(‘database‘); //读取配置文件

pc_base::load_sys_class(‘mysql‘, ‘‘, 0);

pc_base::load_sys_class(‘param‘, ‘‘, 0);

pc_base::load_model(‘content_model‘);$db=new mysql();$db->open($db_config[‘default‘]);$pre = $db_config[‘default‘][‘tablepre‘]; //读取表前缀

$db->connect();$catprefix = ‘list‘;$catrule .= "\n";$catrule .= "RewriteEngine on\n";$catdata = $db->select(‘catid,catdir,parentid‘,"{$pre}category","type=0");foreach($catdata as $item){$catdir = $item[‘catdir‘];$catid = $item[‘catid‘];$parentid = $item[‘parentid‘] ? $item[‘parentid‘] : "";if(trim($parentid)){$parentdir = $db->select(‘catdir‘,"{$pre}category","catid={$parentid}")[0][‘catdir‘];$catrule .= "RewriteRule ^{$parentdir}/{$catdir}/([0-9]+)-([0-9]+).html index.php?m=content&c=index&a=show&catid={$catid}&id=$2&page=$3\n";

}$catrule .= "RewriteRule ^{$catdir}/([0-9]+)-([0-9]+).html index.php?m=content&c=index&a=show&catid={$catid}&id=$2&page=$3\n";

}$catrule .= "RewriteRule ^{$catprefix}/([0-9]+)_([0-9]+).html index.php?m=content&c=index&a=lists&catid=$1&page=$2\n";$catrule .= "\n";file_put_contents(PHPCMS_PATH.‘/.htaccess‘,$catrule);/*RewriteEngine on

RewriteRule ^content-([0-9]+)-([0-9]+)-([0-9]+).html index.php?m=content&c=index&a=show&catid=$1&id=$2&page=$3

RewriteRule ^show-([0-9]+)-([0-9]+)-([0-9]+).html index.php?m=content&c=index&a=show&catid=$1&id=$2&page=$3

RewriteRule ^list-([0-9]+)-([0-9]+).html index.php?m=content&c=index&a=lists&catid=$1&page=$2*/

SEO工具箱:PHP自动生成PHPCMS伪静态规则.htaccess

标签:colcontents技术tac描述comrectzhang友好

本条技术文章来源于互联网,如果无意侵犯您的权益请点击此处反馈版权投诉

本文系统来源:/wuzhi-seo/p/7522103.html

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。