Magento - 路由
Magento - Routing
问题是,我可以在
上访问我的页面
http://domain.com:8080/
但是当我尝试进入管理员时
http://domain.com:8080/admin
404错误
但是当我添加:
http://domain.com:8080/index.php/admin
有效
我需要将其设置为这样工作
http://domain.com:8080/admin
我的虚拟主机看起来像
<VirtualHost domain.com:8080>
DocumentRoot "C:\xampp\htdocs\magento\magento"
ServerName domain.com
<Directory "C:\xampp\htdocs\magento\magento">
Require all granted
Allow from all
</Directory>
我已经签到了:
文件:app/code/core/Mage/Core/Controller/Varien/Router/Standard.php -> _validateControllerClassName
但它不只是去那里
有什么建议吗?
当您的项目根目录中有标准 .htaccess
文件时,它应该可以工作。以下配置应将所有未指向真实文件的内容重写为 index.php
.
<IfModule mod_rewrite.c>
############################################
## enable rewrites
Options +FollowSymLinks
RewriteEngine on
############################################
## you can put here your magento root folder
## path relative to web root
RewriteBase /
############################################
## 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>
但它只有在启用 mode_rewrite 时才有效。
问题是,我可以在
上访问我的页面http://domain.com:8080/
但是当我尝试进入管理员时
http://domain.com:8080/admin
404错误 但是当我添加:
http://domain.com:8080/index.php/admin
有效
我需要将其设置为这样工作
http://domain.com:8080/admin
我的虚拟主机看起来像
<VirtualHost domain.com:8080>
DocumentRoot "C:\xampp\htdocs\magento\magento"
ServerName domain.com
<Directory "C:\xampp\htdocs\magento\magento">
Require all granted
Allow from all
</Directory>
我已经签到了:
文件:app/code/core/Mage/Core/Controller/Varien/Router/Standard.php -> _validateControllerClassName
但它不只是去那里
有什么建议吗?
当您的项目根目录中有标准 .htaccess
文件时,它应该可以工作。以下配置应将所有未指向真实文件的内容重写为 index.php
.
<IfModule mod_rewrite.c>
############################################
## enable rewrites
Options +FollowSymLinks
RewriteEngine on
############################################
## you can put here your magento root folder
## path relative to web root
RewriteBase /
############################################
## 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>
但它只有在启用 mode_rewrite 时才有效。