环境:XAMP 版本magento1.4.1.0
Apache开启mod_rewrite和mod_alias后,建立虚拟目录安装Magento
完成之后默认的Use Web Server Rewrites 设置项为 No
这个时候进入子页面 往往会出现类似 The requested URL /…../…. was not found on this server 的错误
如果在其中加入index.php就可以正常访问了…
eg:127.0.0.1/magento/customer/account/login/ 无法正常访问
修改为: 127.0.0.1/magento/index.php/customer/account/login/
后就可以正常访问了.
这个时候我们可以将Use Web Server Rewrites设置为Yes即可。
如果还不行,那么请检查你网站的.htaccess文件。
Magento的URL重写规则如下:
############################################
## Magneto URL Rewrite
<IfModule mod_rewrite.c>
############################################
## enable rewrites
Options +FollowSymLinks
RewriteEngine on
############################################
## 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>
############################################
注:RewriteBase的路径即网站根目录。
这样开启Use Web Server Rewrites后就可以去掉URL中index.php正常访问了。
评论