添加到根文件夹时,Magento中无法访问.html文件

时间:2015-06-23 15:50:22

标签: .htaccess magento redirect

我正在运行Magento网站,需要将google网站所有权确认文件上传到根目录。当我这样做时,如果键入如下www.website.com/google0564e497cc4446t6.html,则无法通过URL访问html文件,而是获得了404页面。其他文件格式工作得很好。我的结论是必须有一个.htaccess重定向。

这是.htaccess内容:

## enable rewrites

    Options +FollowSymLinks
    RewriteEngine on
##  RewriteRule ^(.)ItemDesc.asp?IC=(.)$ $1$2 [L]
##  RewriteRule ^supply-items/$ ItemDesc.asp?IC= [NC,L]
RewriteRule ^([^/]*)\.html$ /ItemDesc.asp?IC=$1 [L]
##RewriteRule ^ItemDesc.asp?IC=$ supply-items/ [L,R=301]
RewriteRule test_rewrite\.html http://www.website.com/rewrite_successful.html [R=301,L]
RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

事实证明,以前的网站重定向对于维护SEO非常重要,所以我不能只删除它们。但是,有没有办法使用.htaccess文件对特定的.html文件例如www.website.com/google0564e497cc4446t6.html进行例外处理?

谢谢!

1 个答案:

答案 0 :(得分:1)

您可以修改规则的第一部分,并添加条件以跳过Google文件。

RewriteCond %{REQUEST_URI} !^/google(.*)\.html$
RewriteRule ^([^/]*)\.html$ /ItemDesc.asp?IC=$1 [L]