Opencart SEO 优化

MisterF

资源组
资源管理组
外贸币
829.90G
OpenCart 在线时可以让商店使用搜索引擎优化网址(Search Engine Optimized URLs),此功能可以设置品牌信息设计目录、产品、品牌及信息设计面页面中。SEO关键字可以定义各种页面并记录在资料库表格中 url_alias中,查看每个页面要求,并转换成内部网址。

启用SEO关键字功能

如想启用SEO关键字功能,前往Opencart系统-中的设定(设置)页面,在后台设定中可以找到启用此功能的按钮。

admin-enable-seo-url.png


服务器设定文件

当下载整个 OpenCart 时,他们已经拥有了可以使服务器可以从 SEO 关键字功能的编码。请先开启。),将.txt的后缀去掉后,便可以使用功能。但如果还没有效果,请向你的空间服务商咨询支持此功能。

以下为 .htaccess 文件中的代码:

Apache 配置:
# 1.To use URL Alias you need to be running apache with mod_rewrite enabled.
# 2. In your opencart directory rename htaccess.txt to .htaccess.
# For any support issues please visit: http://www.opencart.com
Options +FollowSymlinks
# Prevent Directoy listing
Options -Indexes
# Prevent Direct Access to files
<FilesMatch "\.(tpl|ini|log)">
 Order deny,allow
 Deny from all
</FilesMatch>
# SEO URL Settings
RewriteEngine On
# If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/
RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
### Additional Settings that may need to be enabled for some servers
### Uncomment the commands by removing the # sign in front of it.
### If you get an "Internal Server Error 500" after enabling any of the following settings, restore the # as this means your host doesn't allow that.
# 1. If your cart only allows you to add one item at a time, it is possible register_globals is on. This may work to disable it:
# php_flag register_globals off
# 2. If your cart has magic quotes enabled, This may work to disable it:
# php_flag magic_quotes_gpc Off
# 3. Set max upload file size. Most hosts will limit this and not allow it to be overridden but you can try
# php_value upload_max_filesize 999M
# 4. set max post size. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value post_max_size 999M
# 5. set max time script can take. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value max_execution_time 200
# 6. set max time for input to be recieved. Uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value max_input_time 200
# 7. disable open_basedir limitations
# php_admin_value open_basedir none

.htaccess 文件必须放置在商店的根目录(Root Folder)内,否则整个功能是不能够运作。假如从cPanel内找不到这个文件,可以先尝试从设定中查看是否隐藏了部份格式的文件。但真的没有这个档案的存在,可以复制上方的编码并命名文件为 .htaccess 亦可。

如果OpenCart存放的位置是 public_html/store 时,便要将以下的编码改成:

PHP:
RewriteBase /store

文件预设时,重写引擎是启用的,如果使用者并不是从 OpenCart 官方网站自行下载时,而功能并未成功启用,可以查看以下的编码是否被设成 Off

PHP:
RewriteEngine On

每一个SEO关键字也是独一无二的,不能重覆使用。所以定立SEO关键字时,都必须清晰代表每页。而SEO关键字只可以使用"-"作为字与字之间的分隔,空白键或其他符号是不允许使用的。

PHP:
nikon-camera (对)
nikon camera (错)

admin-product-seo-url-example.png


上述图片以产品「Nikon D300」为例,将产品的SEO关键字设定为 nikon-d300,之后储存变更。在第一及第二步的设定确认经已启用后,再于网址中输入下列字眼:

PHP:
www.mystore.com/nikon-d300

store-front-seo-url-example.png


总括而言,创建SEO关键字将有助整理商店页面的网址并优化网站于搜索引擎的评分。
 
最后编辑:
顶部