新闻中心

海盗商城如何设置伪静态

作者 / 无忧主机 时间 2018-05-23 18:20:17

PHP网站优化,动态网站生态静态页和实现伪静态是必走之路,伪静态是将动态语言的后缀通过一定的手段,转为 html后缀,服务器上实际访问的是动态的地址,蜘蛛对html后缀的网页比较友好。不少网站就采用这样的方式,这样可以欺骗蜘蛛以达到seo优化的效果。海盗云商作为一款优秀的php建站系统,支持多种服务器环境的伪静态设置,无忧主机小编以独立IP虚拟主机为例,为大家介绍海盗商城设置伪静态的方法。 1、在后台开启伪静态 登录海盗商城网站后台,打开全局->优化设置->URL伪静态,如图1所示,将需要开启伪静态的页面状态点击启用,如果需要开启所有页面的伪静态,就将整个列表的状态设置为启用。 2、定义规则 下载好海盗商城源码后,程序默认自带了各种服务器环境下的伪静态规则,如果您是无忧主机用户,定义规则的方式是:在程序根目录建立一个规则文件命名为.htaccess,然后将下面的代码拷贝进去。

RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^lists-([0-9]+).html$ index.php?m=goods&c=index&a=lists&id=$1&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^goods-([0-9]+).html$ index.php?m=goods&c=index&a=detail&sku_id=$1&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^brand-([0-9]+).html$ index.php?m=goods&c=index&a=brand_list&id=$1&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^buyer.html$ index.php?m=member&c=index&a=index&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^help-lists-([0-9]+).html$ index.php?m=misc&c=index&a=help_lists&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^help-detail-([0-9]+).html$ index.php?m=misc&c=index&a=help_detail&id=$1&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^article-lists-([0-9a-zA-Z]+).html$ index.php?m=misc&c=index&a=article_lists&category_id=$1&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^article-detail-([0-9]+).html$ index.php?m=misc&c=index&a=article_detail&id=$1&%1
如果是使用Nginx或iis服务器,可以参考程序根目录的伪静态配置说明进行操作。需要注意的是,上面的设置方法中,Apache需要开启mod_rewrite,开启方法是打开httpd.conf配置文件 # LoadModule rewrite_module modules/mod_rewrite.so 去除前面的#即可。 3、检验伪静态是否开启 检验伪静态是否开启成功的方法,在商城中访问一个连接,如图3所示,访问会员中心的页面,浏览器的地址栏是以.html结尾的后缀,说明伪静态已开启成功。 以上就是独立IP空间环境下海盗商城的伪静态设置教程

本文地址:https://www.51php.com/haidao/26725.html

1
1
1
1
1
1
1

客户服务热线

0791-8623-3537

在线客服