【发布时间】:2015-06-07 09:24:31
【问题描述】:
我在 Magento 根文件夹的 .htaccess 文件中创建了一个自定义重定向。 magento 的基本 url 是http://127.0.0.1/mymagento/
## enable rewrites
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^kit-rasage.html /spray-can.html [R=301,L]
但是当我访问http://127.0.0.1/mymagento/kit-rasage.html 时,它会重定向到http://127.0.0.1/kit-rasage.html
httpdconf文件中的文档根目录如下
<Directory "C:/xampp/htdocs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks Includes ExecCGI
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
操作系统是windows 7,我使用的是XAMPP。 如何解决?
【问题讨论】:
-
您将文档根定义为什么?
-
@PanamaJack 我应该在哪里检查这个?
-
在您的虚拟主机文件中。可能是httpd.conf。你设置了吗?
-
@PanamaJack 请查看更新后的问题
-
如果它在 magento 文件夹中,请尝试将 RewriteBase 设置在您的规则之上。
RewriteBase /mymagento/
标签: .htaccess magento redirect url-rewriting xampp