【问题标题】:301 redirects in magento not workingMagento中的301重定向不起作用
【发布时间】:2012-06-19 21:00:45
【问题描述】:

我刚刚将一个网站移至 magento,但并非所有网址都保持不变。我在更改 301 时遇到问题。

首先我使用的是 magento 多站点设置,并且我的 .htaccess 文件中运行了以下代码:

RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
SetEnvIf Host www\.domain1\.com MAGE_RUN_CODE=website1code
SetEnvIf Host www\.domain1\.com MAGE_RUN_TYPE=website
SetEnvIf Host ^domain1\.com MAGE_RUN_CODE=website1code
SetEnvIf Host ^domain1\.com MAGE_RUN_TYPE=website

SetEnvIf Host www\.domain2\.net MAGE_RUN_CODE=website2code
SetEnvIf Host www\.domain2\.net MAGE_RUN_TYPE=website
SetEnvIf Host ^domain2\.net MAGE_RUN_CODE=website2code
SetEnvIf Host ^domain2\.net MAGE_RUN_TYPE=website

这是我尝试重定向的网址的一个示例:

old:  http://domain1.com/category
new:  http://domain1.com/v1/category

这是我尝试过的:

1) 首先我尝试在 .htaccess 文件中添加一个简单的行:

redirect 301 /category http://domain1.com/v1/category

2) 我还尝试按照此处的指南在管理面板中使用内置的 url 重写管理器

http://www.magentocommerce.com/wiki/modules_reference/english/mage_adminhtml/urlrewrite/index

http://www.magentocommerce.com/wiki/3_-_store_setup_and_management/seo/how_to_work_with_magento_url_rewrite_rules

我在管理面板中使用了以下设置:

type: custom
store: chose
id path: /category
request path: /category
target path: http://domain1.com/v1/category
redirect: 301

有人可以解释我做错了什么,并建议直接编辑 .htaccess 或在管理区域内的替代方法吗?

谢谢

【问题讨论】:

  • 有人对此有任何想法吗?

标签: apache magento redirect http-status-code-301


【解决方案1】:

下面是我最后一个虚拟主机上从.htaccess 到子目录的 301 域重定向。请注意,此文件夹所在的域不是下面显示的域(实际上是我个人资料中的域),因此它是其他域指针的子目录类型。

RewriteEngine On
RewriteRule ducatitech/(.*) http://www.ducatitech.com/$1 [R=301]
Redirect 301 /ducatitech http://www.ducatitech.com

除了与您分享上述内容外,我还没有针对 magento 多商店安装进行任何域共享。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-02-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-05
    • 2013-11-27
    相关资源
    最近更新 更多