ZENCART消除SEO URL中重复的网址/页面
2012-09-27 18:50
429 查看
打开文件 \includes\classes\seo.url.php
找到:
代码: 全选
在前面加上:
代码: 全选
商店设置-搜索引擎优化-打开自动跳转吗?,设置为 true
本文出自 “电子商务解决方案” 博客,请务必保留此出处http://wmrwx.blog.51cto.com/1418507/1008480
找到:
代码: 全选
$this->attributes['SEO_REDIRECT']['NEED_REDIRECT'] = $this->need_redirect ? 'true' : 'false';
在前面加上:
代码: 全选
// check product name from URL and redirect if not equal to real product name to avoid duplicates if ( preg_match('/-p-[0-9]/i', $this->uri) && preg_match('/main_page=product_info/i', $this->real_uri) ) { $productname_from_url = preg_replace('/-p-[0-9].*/i','',$this->uri); $productid_from_url= preg_replace('/.*-p-([0-9]+)\.html/i','$1',$this->uri); if ( $this->get_product_name($productid_from_url) != $productname_from_url ) { $this->need_redirect = true; // repeating procedure from function check_redirect() but for real_uri if ($this->is_attribute_string($this->real_uri)) { $parsed_url = parse_url($this->real_uri); $this->uri_parsed = parse_url($parsed_url['scheme']); $this->uri_parsed['query'] = preg_replace('/products_id=([0-9]+)/', 'products_id=$1:' . $parsed_url['path'], $this->uri_parsed['query']); } else { $this->uri_parsed = parse_url($this->real_uri); } } } // end of product_info URL redirect // check category name from URL and redirect if not equal to real category name to avoid duplicates if ( preg_match('/-c-[0-9]/i', $this->uri) && preg_match('/main_page=index/i', $this->real_uri) ) { $categoryname_from_url = preg_replace('/-c-[0-9].*/i','',$this->uri); $categoryid_from_url= preg_replace('/.*-c-([0-9]+)\.html/i','$1',$this->uri); if ( $this->get_category_name($categoryid_from_url) != $categoryname_from_url ) { $this->need_redirect = true; // repeating procedure from function check_redirect() but for real_uri if ($this->is_attribute_string($this->real_uri)) { $parsed_url = parse_url($this->real_uri); $this->uri_parsed = parse_url($parsed_url['scheme']); $this->uri_parsed['query'] = preg_replace('/cPath=([0-9]+)/', 'cPath=$1:' . $parsed_url['path'], $this->uri_parsed['query']); } else { $this->uri_parsed = parse_url($this->real_uri); } } } // end of category URL redirect
第二步
商店设置-搜索引擎优化-打开自动跳转吗?,设置为 true
本文出自 “电子商务解决方案” 博客,请务必保留此出处http://wmrwx.blog.51cto.com/1418507/1008480
相关文章推荐
- Zencart消除SEO URL中重复的网址或者页面
- zencart安装SEO URL插件后出现重复网址或页面解决办法
- 完美解决zencart SEO模块存在重复网址的问题
- 如何用js得到当前页面的url信息方法(JS获取当前网址信息)
- 使用jquery在前台页面验证url网址输入是否正确
- js获取当前页面的url网址信息
- 如何用js得到当前页面的url信息方法(JS获取当前网址信息)
- 如何用js得到当前页面的url信息方法(JS获取当前网址信息)
- [HTML][Javascrpt]如何取得当前页面网址(URL)和查询参数
- js如何准确获取当前页面url网址信息
- Zencart多语言URL设定SEO实施方案
- JavaScript 取得当前页面的URL网址参数
- C# 动态添加SEO 信息,不和静态页面重复和叠加
- js如何准确获取当前页面url网址信息
- js如何准确获取当前页面url网址信息
- JS获取当前网址,JS获取当前域名URL ,JS获取网站完整路径页面地址
- 防止盗链问题:Javascript从A页面跳到B页面,B页面无法获取A页面网址来源,即B页面的Request.UrlReferrer为null
- 刷新网址栏导致页面重复提交解决办法
- 如何用js得到当前页面的url信息方法(JS获取当前网址信息)
- 如何用js得到当前页面的url信息方法(JS获取当前网址信息)