【问题标题】:301 Redirect Dynamic to static URL - Magento301 将动态重定向到静态 URL - Magento
【发布时间】:2012-11-01 15:29:38
【问题描述】:

对于我的一生以及我多年来使用 .htaccess 的经验,我无法让这个简单的重定向工作......我完全被难住了,所以任何帮助都会很棒;

来自: http://www.offices-furniture.co.uk/pp?prod=fridgemaster-desk-fan.html

到: http://www.offices-furniture.co.uk/fridgemaster-desk-fan.html

应该很简单,但是哦不..

我正在使用 magento,拥有自己的专用服务器,因此可以完全访问所有内容

【问题讨论】:

  • 我尝试过使用:RewriteRule ^([^/]*)$ /pp?prod=$1 [L] 但导致 500 服务器错误还尝试过:RedirectMatch 301 ^pp?prod=( .*)\.htm$ offices-furniture.co.uk/$1

标签: php .htaccess magento


【解决方案1】:

使用插件 使用这个简单而强大的 URL 重定向管理工具让您顺利过渡到 Magento。

http://www.magentocommerce.com/magento-connect/smooth-move-seo-301-redirect-handler-3958.html

【讨论】:

  • 感谢 Ernesto,但我只需要 .htaccess 代码,我不会移动软件。
【解决方案2】:

http://www.mbstrategic.com/02/301-redirects-for-dynamic-urls-to-static-pages-with-htaccess/

使用 htaccess 将动态 URL 的 301 重定向到静态页面

htaccess中需要文章id,查看excel表格

【讨论】:

  • 嗨欧内斯特 - 我已经详细阅读了那篇文章。 excel 下载链接已损坏。谢谢
  • 对我来说,指向 excel 的链接没有损坏。我用openoffice
  • 我刚刚对开放式办公室做了同样的事情并使用了该工具。但是输出; RewriteCond %{QUERY_STRING} ^prod=fridgemaster-desk-fan.html$ RewriteRule ^pp$ offices-furniture.co.uk? [R=301,L] 什么都不做
  • 尝试用谷歌电子表格打开文件,文件ID文章ID
  • 第 1 行:RewriteCond %{QUERY_STRING} ^id=8$ [NC] 第 2 行:RewriteRule p/view.php office-furniture.co.uk/fridgemaster-desk-fan.html 这使得offices-furniture.co.uk/fridgemaster-desk-fan.html 重定向到主页。第 2 行 - 你确定你不是指 pp/view.php?
【解决方案3】:

过了一段时间终于查到了这个问题。基本上是 Magento 干扰了 htaccess 文件,所以我在另一个网站上进行了测试;

http://www.office-desks.co.uk/solar-cantilever-combi-desks.html 实际上是从 http://www.office-desks.co.uk/cat/product.php?prod=solar-cantilever-combi-desks.html

现在我有漂亮干净的 URL 哇 :)

这是我的 htaccess 代码,可能对某人有所帮助;

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\.html$ cat/product.php?prod=$1

RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^(.*)\.php$ cat/cat.php?cat=$1

RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^([^\.]+)$ cat/cat.php?cat=$1

magento 中导致问题的行是这些(直到通配符);

RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule (.*) m1_seourls.router.php

RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule (.*) m1_seourls.router.php

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-02-12
    • 1970-01-01
    • 2014-07-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-08
    • 1970-01-01
    相关资源
    最近更新 更多