针对特定域的Magento .htaccess规则

时间:2014-03-28 05:32:42

标签: .htaccess magento

我有一个多域magento设置,说 abc.com xyz.com

我只想在根 .htaccess 文件中为 xyz.com 编写重定向规则。当我编写规则时,它会将 abc.com 中的所有网址重定向到 xyz.com和404

基本上我需要将所有 .html网址从xyz.com 重定向到没有.html。 我正在使用:

RedirectMatch 301 (.*)\.html$ http://www.xyz.com$1

1 个答案:

答案 0 :(得分:0)

您可以按照以下步骤删除网址末尾的 .html

System -> configuration -> catalog -> Search Engine Optimizations

在这里,您可以找到名为“产品网址后缀”和“类别网址后缀”的2个属性。只需 清空 XYZ.com商店中的那些字段

enter image description here

修改

   <IfModule mod_rewrite.c>
   RewriteEngine On
   RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /html/(.*).html\ HTTP/
   RewriteRule .* http://urdomain/html/%1 [R=301,L]

   RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /html/(.*)\ HTTP/
   RewriteRule .* %1.html [L]
   </IfModule>

请参阅以下网址

How to remove .html from URL

在这里你可以得到解决方案

<强>更新

我不确定。但我希望,它可以帮到你

RewriteCond %{REQUEST_URI} xyz[NC]

RewriteRule ^(.*)\.html$ /$1 [L,R=301]