Magento - 前端路由器在本地工作,但不在实时服务器上工作
好的,我有一个非常基本的模块设置。这只是一个测试模块,但本质上我应该在访问以下内容时显示“我们在这里”: http: //www.mysite.com/vrmlookup/lookup/form。
问题是它在我的本地计算机(xampp)上运行良好,但是当我在我的实时服务器上尝试它时,我得到了 404。在我看来一切都很好,但我完全困惑了!
这是我的模块:
app/etc/modules/BlueDeep_MamVrm.xml:
<?xml version="1.0"?>
<config>
<modules>
<BlueDeep_MamVrm>
<active>true</active>
<codePool>local</codePool>
</BlueDeep_MamVrm>
</modules>
</config>
app/code/local/BlueDeep/MamVrm/etc/config.xml:
<?xml version="1.0"?>
<config>
<modules>
<BlueDeep_MamVrm>
<version>1.0.0</version>
</BlueDeep_MamVrm>
</modules>
<frontend>
<routers>
<vrmlookup>
<use>standard</use>
<args>
<module>BlueDeep_MamVrm</module>
<frontName>vrmlookup</frontName>
</args>
</vrmlookup>
</routers>
</frontend>
</config>
app/code/local/BlueDeep/MamVrm/controllers/lookupController.php:
class BlueDeep_MamVrm_LookupController extends Mage_Core_Controller_Front_Action
{
public function formAction()
{
die('Here we are');
}
}
我非常确定所有文件权限都是正确的,并且我已经清除了所有缓存。
有什么想法吗? 谢谢
Ok so I have a very basic module setup. It's just a test module but essentially I should get "Here we are" displayed when I go to: http://www.mysite.com/vrmlookup/lookup/form.
The thing is that it works fine on my local machine (xampp) but I get a 404 when I try it on my live sever. It all looks fine to me and I'm utterly confused!
This is my module:
app/etc/modules/BlueDeep_MamVrm.xml:
<?xml version="1.0"?>
<config>
<modules>
<BlueDeep_MamVrm>
<active>true</active>
<codePool>local</codePool>
</BlueDeep_MamVrm>
</modules>
</config>
app/code/local/BlueDeep/MamVrm/etc/config.xml:
<?xml version="1.0"?>
<config>
<modules>
<BlueDeep_MamVrm>
<version>1.0.0</version>
</BlueDeep_MamVrm>
</modules>
<frontend>
<routers>
<vrmlookup>
<use>standard</use>
<args>
<module>BlueDeep_MamVrm</module>
<frontName>vrmlookup</frontName>
</args>
</vrmlookup>
</routers>
</frontend>
</config>
app/code/local/BlueDeep/MamVrm/controllers/lookupController.php:
class BlueDeep_MamVrm_LookupController extends Mage_Core_Controller_Front_Action
{
public function formAction()
{
die('Here we are');
}
}
I'm pretty certain that all file permissions are correct and I have cleared all cache.
Any ideas?!
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题出在您的控制器文件名中。它应该是大写的(LookupController.php 不是lookupController.php)。在 Windows (xampp) 上这并不重要,但在真实服务器(linux/unix 服务器)上文件名是区分大小写的。 Magento 开发应该在 Linux 系统上进行,这样更容易(您不必追踪奇怪的错误 - 就像这个)。尝试使用虚拟机作为服务器,并通过 Samba 访问您的文件。我就是这样工作的,不会有任何问题。
当您的 Magento MySQL 服务器在 Windows 上运行时,您可能会遇到非常长的响应时间(尤其是在重新索引时)。使用虚拟机,您可以使用您最喜欢的 Windows 工具并在接近生产环境的环境中测试您的应用程序。
The problem is in your controllers filename. It should be upper cased (LookupController.php not lookupController.php). On Windows (xampp) it doesn't matter, but on a real server (a linux/unix one) filenames are case-sensitive. Magento development should be performed on a linux system, its easier that way (you don't have to track down strange errors - like this one). Try a virtual machine as a server, and access your file via Samba. I work that way, and it doesn't make any problems.
When your Magento MySQL server is running on Windows, you could suffer from very big response times (especially while reindexing). Using a virtual machine, lets you to use your favorite Windows tools and test your app in an environment close to the production one.