# 设置搜索引擎优化 / SEO,去掉zenid办法

**URL:** <https://www.isharkfly.com/t/seo-zenid/3842>\
**Category:** PHP\
**Created:** [August 6, 2012, 3:40am UTC](https://www.isharkfly.com/t/seo-zenid/3842 "2012-08-06T03:40:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![honeymoose](https://www.isharkfly.com/user_avatar/www.isharkfly.com/honeymoose/32/20796_2.png) [@honeymoose](https://www.isharkfly.com/u/honeymoose)\
**Post date:** [August 6, 2012, 3:40am UTC](https://www.isharkfly.com/t/seo-zenid/3842/1 "2012-08-06T03:40:54Z")

</div>

本帖最后由 紫衫木 于 2012-8-6 11:42 编辑

后台的 商店设置－搜索引擎优化 选项下打开SEO功能，SEO模块需要检查的就三个地方：

1. 确认网站支持mod\_rewrite，且主机允许你使用自己的.htaccess文件

2. .htaccess 文件名字正确 （前面有个点）

3. 将根目录下的文件htaccess\_sample改名为 .htaccess，并修改其中的 /shop/ 为您的zen cart目录。  
如果你的域名指向的目录是zencart的根目录，那么 RewriteBase /  
如果是 这样的形式打开网站，那么 RewriteBase /zencart/

.htaccess内容：[code]##### NOTE: Replace /shop/ with the relative web path of your catalog in the “Rewrite Base” line below:

Options +FollowSymLinks  
RewriteEngine On  
RewriteBase /zc/

# 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] RewriteRule ^(.\*)-ezp-([0-9]+).html index.php?main\_page=page&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] [/code]去除zencart程序的zenid有两种方法

１）在后台 Configuration-\>session 将 Force Cookie Use 设置为ture;  
一般如果网站只是在刚开启的时候存在 zenid 的话，只要这样设置一下就可以了；  
另一种就是从头到尾，ＵＲＬ地址后面一直都会有一串zenid= 参数后缀，这个情况可能是因为缓存文件夹没有写分配权限或者不存在，可以试试方案2。

２）引用英文论坛上的一个正确回复：  
In case some of you are wondering why zen\_id is all of a sudden being added to your links (or always has) and you want it gone:  
Be sure that your “Session Directory” in Configuration\>Sessions is set to a directory that actually exists and is writable. If the directory doesn’t exist, then Zen Cart will starting adding zenid to URLS.  
Hope this helps.  
这句话的意思就是说在zen-cart后台的 Configuration\>Sessions 里有一项 Session Directory，它是指定session所使用的文件夹的，如果这个文件夹不存在或者不可写的话，那么就会在URL上显示 zenid= ，解决方法就是让这个项所指向的文件夹存在并且可写。
