This do SEO time very need, before from Dedecms to Phpcms, the most painful is to set pseudo-static, always want to set column name/article id.html such rules, but obviously phpcms default does not provide, only provide the most original List-1-1.html, show-1-1.html, this URL for the search engine and users are not friendly (not in line with the Baidu Search engine guide in the URL-friendly description), haha, or just oneself tangled.
If you have to do so before, it is necessary to add a manual, did not think that one day I can also break the problem (in fact, just a simple reading database problem).
Step One: Phpcms background settings Rule (Apache pseudo-static is turned on by default)
Part II: Build. htaccess
Copy the following file to the document, the suffix to php, place the root directory of the Phpcms, and run the http://admin.com/settings file. php to generate the. htaccess file
<?PHPDefine(' Phpcms_path ',dirname(__file__).directory_separator);includePhpcms_path. ' /phpcms/base.php ';//Pc_base::creat_app ();$db _config= Pc_base::load_config (' database ');//reading configuration FilesPc_base::load_sys_class (' MySQL ', ', 0);p c_base:: Load_sys_class (' param ', ', 0);p c_base:: Load_model (' Content_model ');$db=New MySQL();$db->open ($db _config[' Default ']);$pre=$db _config[' Default '] [' Tablepre '];//Reading table Prefixes$db-Connect ();$catprefix= ' list ';$catrule. = "<ifmodule mod_rewrite.c>\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. = "</ifmodule>\n";file_put_contents(Phpcms_path. ' /.htaccess ',$catrule);/*rewriteengine onrewriterule ^content-([0-9]+)-([0-9]+)-([0-9]+). HTML index.php?m=content&c=index&a= Show&catid=$1&id=$2&page=$3rewriterule ^show-([0-9]+)-([0-9]+)-([0-9]+). HTML index.php?m=content &c=index&a=show&catid=$1&id=$2&page=$3rewriterule ^list-([0-9]+)-([0-9]+). HTML index.php?m= Content&c=index&a=lists&catid=$1&page=$2*/
SEO Toolbox: PHP automatically generates PHPCMS pseudo-static rules. htaccess