SEO的URL路径是很重要的.比如一个网站的内页路径最好是被关键字,层次分明,以.html结束,例如:https://www.XXXXX.com/产品分类名/产品名称(或是加一些自己所需要的关键词).html.但是zencart系统就只会不会让你如意,要进行一些修改后,才可以变成你想要的URL结果.下面的步骤就是讲怎么来现实这个效果,从而达到SEO理想化状态.

1.首要将网页进行静态化,而zencart是使用的伪静态技术.很把网站打个包上传到FTP空间,然后进行解压.配置好后将根目录的htaccess_sample用记事本打开,将文件另存为”.htacces”,打开文件改里面相对就的内容(改的地名有注释):

##### NOTE: Replace /shop/ with the relative web path of your catalog in the “Rewrite Base” line below:

Options +FollowSymLinks

RewriteEngine On

RewriteBase /shop/ (这里如果是根目录就改成’ RewriteBase /’,如果不是就改成’ RewriteBase /文件夹名称/’)

# From Ultimate SEO URLs

RewriteRule ^(.*)-p-(.*).html$ index.php?main_page=product_info&products_id=$2&%{QUERY_STRING} [L]

RewriteRule ^(.*)-c-(.*).html$ index.php?main_page=index&cPath=$2&%{QUERY_STRING} [L]

RewriteRule ^(.*)-m-([0-9]+).html$ index.php?main_page=index&manufacturers_id=$2&%{QUERY_STRING} [L]

RewriteRule ^(.*)-pi-([0-9]+).html$ index.php?main_page=popup_image&pID=$2&%{QUERY_STRING} [L]

RewriteRule ^(.*)-pr-([0-9]+).html$ index.php?main_page=product_reviews&products_id=$2&%{QUERY_STRING} [L]

RewriteRule ^(.*)-pri-([0-9]+).html$ index.php?main_page=product_reviews_info&products_id=$2&%{QUERY_STRING} [L]

# For Open Operations Info Manager

RewriteRule ^(.*)-i-([0-9]+).html$ index.php?main_page=info_manager&pages_id=$2&%{QUERY_STRING} [L]

# For dreamscape’s News & Articles Manager

RewriteRule ^news/?$ index.php?main_page=news&%{QUERY_STRING} [L]

RewriteRule ^news/rss.xml$ index.php?main_page=news_rss&%{QUERY_STRING} [L]

RewriteRule ^news/archive/?$ index.php?main_page=news_archive&%{QUERY_STRING} [L]

RewriteRule ^news/([0-9]{4})-([0-9]{2})-([0-9]{2}).html$ index.php?main_page=news&date=$1-$2-$3&%{QUERY_STRING} [L]

RewriteRule ^news/archive/([0-9]{4})-([0-9]{2}).html$ index.php?main_page=news_archive&date=$1-$2&%{QUERY_STRING} [L]

RewriteRule ^news/(.*)-a-([0-9]+)-comments.html$ index.php?main_page=news_comments&article_id=$2&%{QUERY_STRING} [L]

RewriteRule ^news/(.*)-a-([0-9]+).html$ index.php?main_page=news_article&article_id=$2&%{QUERY_STRING} [L]

# All other pages

# Don’t rewrite real files or directories

RewriteCond %{REQUEST_FILENAME} !-f [NC]

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*).html$ index.php?main_page=$1&%{QUERY_STRING} [L]

2.进入后台,选择” Configuration->搜索引擎优化”,单击” 打开搜索引擎优化吗?”在右边选择”ture->update”.这样就将zencart静态化了,不过还差后台的&zenid.

3.打开文件” includes/functions/html_output.php”修改如下:

function original_zen_href_link($page = ”, $parameters = ”, $connection = ‘NONSSL’, $add_session_id = true, $search_engine_safe = true, $static = false, $use_dir_ws_catalog = true)

改成

function original_zen_href_link($page = ”, $parameters = ”, $connection = ‘NONSSL’, $add_session_id = false, $search_engine_safe = true, $static = false, $use_dir_ws_catalog = true)

function zen_href_link($page = ”, $parameters = ”, $connection = ‘NONSSL’, $add_session_id = true, $search_engine_safe = true, $static = false, $use_dir_ws_catalog = true) {

改成

function zen_href_link($page = ”, $parameters = ”, $connection = ‘NONSSL’, $add_session_id = false, $search_engine_safe = true, $static = false, $use_dir_ws_catalog = true) {

4.保存,刷新页面即可.