0

我正在尝试从我们的网址中删除某个字符串“.html”

当前示例网址:

http://www.buildingmaterialsonline.com.au/insulation/by-brand/pink-batts/l/price-6,10///.html?dir=asc&order=price

至:

http://www.buildingmaterialsonline.com.au/insulation/by-brand/pink-batts/l/price-6,10///?dir=asc&order=price

我当前的 htaccess 文件是:

############################################
## enable rewrites

    Options +FollowSymLinks
    RewriteEngine on

#If request contains ref param
RewriteCond %{THE_REQUEST} \?([^&\ ]+).html=  [NC]  
#redirect to URL without the html param
RewriteRule ^  %{REQUEST_URI}?%1 [L,R=301] 

############################################
## you can put here your magento root folder
## path relative to web root

    #RewriteBase /magento/

############################################
## workaround for HTTP authorization
## in CGI environment

    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

############################################
## always send 404 on missing files in these folders

    RewriteCond %{REQUEST_URI} !^/(media|skin|js)/

############################################
## never rewrite for existing files, directories and links

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l

############################################
## rewrite everything else to index.php

    RewriteRule .* index.php [L]

</IfModule>

任何帮助,将不胜感激

4

2 回答 2

0

您不需要使用 htaccess 来执行此操作。

Magento 在后端有一个选项来添加这些后缀。默认为 .html。

本文介绍了如何更改它:

http://php.quicoto.com/how-to-remove-html-from-magento/

于 2012-05-31T01:36:45.517 回答
0

Magento 提供了一个简单的选项来从类别和产品 URL 中删除 .html。

您不需要使用 .htaccess 进行任何操作。

转到系统 --> 配置

然后单击左侧菜单中的目录。

然后在“搜索引擎优化”选项卡下,从“产品 URL 后缀”和“类别 URL 后缀”中删除“.html”。

单击“保存配置”按钮。

注意:如果您愿意,可以为这些条目设置任何其他后缀。

于 2014-02-12T07:55:36.847 回答