修改shopex4.85的htacess文件,实现301重定向

星期天, 一月 24, 2010 0:06
文章发表自: 心得技巧
460次浏览 4 条评论
shopex485的htacess设置301重定向
shopex485的htacess设置301重定向

 网站升级到Shopex4.85了。这个公布的正式版,小问题不少。升级后发现文章地址、商品地址、帮助中心等等的链接都改变了。Google了很多资料,我决定使用htacess文件的301重定向功能,告诉搜索引擎我的地址改变到哪里。
先把根目录下的root.htacess下载到本地,把root去掉。用文本直接编辑。在原来的代码基础上,加入我修改的代码。下面是我写的代码,可以参考修改。
方法如下:

  1. #$Id: root.htaccess 17348 2008-12-23 05:53:22Z flaboy $
  2.  
  3. AddEncoding gzip .jgz
  4. AddType "text/javascript;charset=UTF-8" .jgz
  5.  
  6. AddEncoding gzip .zcss
  7. AddType "text/css;charset=UTF-8" .zcss
  8.  
  9. <IfModule mod_rewrite.c>
  10. RewriteEngine  on
  11. # 这里是我加入的代码,前面为原来网店的地址,后面是升级后改变的地址。
  12. RewriteCond %{HTTP_HOST} ^www.这个是我的网店地址.com$
  13. RewriteRule ^product_([0-9]+)\.html$ product-$1.html  [R=301,L]
  14. RewriteRule ^feedback\.html$ message.html  [R=301,L]
  15. RewriteRule ^feedback_([0-9]+)\.html$ message-$1.html  [R=301,L]
  16. RewriteRule ^catalog_([0-9]+)\.html$ gallery-$1.html  [R=301,L]
  17. RewriteRule ^list\.html$ gallery.html  [R=301,L]
  18. RewriteRule ^list_([0-9]+)\.html$ gallery---0--$1--index.html  [R=301,L]
  19. RewriteRule ^faq\.html$ page-helpcenter.html  [R=301,L]
  20. RewriteRule ^howtobuy\.html$ page-pay.html [R=301,L]
  21. RewriteRule ^aboutus\.html$ page-about.html [R=301,L]
  22. RewriteRule ^list_recommend\.html$ gallery--t,4-0.html [R=301,L]
  23. RewriteRule ^bulletin\.html$ artlist-107.html [R=301,L]
  24. RewriteRule ^catalog\.html$ page-catalog.html [R=301,L]
  25.  
  26. RewriteRule ^message_618.html$ article-103.html [R=301,L]
  27. RewriteRule ^message_124.html$ article-148.html [R=301,L]
  28. RewriteRule ^message_126.html$ article-150.html [R=301,L]
  29. RewriteRule ^message_127.html$ article-151.html [R=301,L]
  30. RewriteRule ^message_128.html$ article-152.html [R=301,L]
  31.  
  32. # 设置RewriteBase的值为你的商店目录地址
  33. RewriteBase /
  34. RewriteRule ^themes/.*\.(html|xml)$ / [F]
  35. RewriteCond %{REQUEST_FILENAME} \.(html|xml|....)$
  36. RewriteCond %{REQUEST_FILENAME} !-f
  37. RewriteCond %{REQUEST_FILENAME} !-d
  38. RewriteRule ^(.*)$ index.php?$1 [L]
  39. </IfModule>
  40.  
  41. <IfModule mod_security.c>
  42. SecFilterEngine Off
  43. SecFilterScanPOST Off
  44. </IfModule>
你可以对这篇文章 发表评论, 或者 trackback 到你的网站.

“修改shopex4.85的htacess文件,实现301重定向”有4 条评论

  1. 昆明seo 说:

    七月 6th, 2010 at 8:46 上午

    博主,能不能隐藏底部版权信息哈?

    [回复]

    tomgo 回复:

    可以使用CSS的方法假隐藏。 ;-)

    [回复]

  2. 碧生源 说:

    三月 19th, 2010 at 7:29 下午

    嘿嘿 第一次来本博客 希望博主多多更新哦 以后会经常来的。。。。

    [回复]

  3. 海南特产 说:

    三月 9th, 2010 at 11:04 下午

    正需要,谢谢分享!!!

    [回复]

请发表您的意见: