简体   繁体   English

上传到另一个文件夹后,在zend框架中指定的错误无效控制器

[英]error invalid controller specified in zend framework after upload to another folder

My problem is, when i upload my project into hosting: 我的问题是,当我将项目上传到托管时:

http://172.20.30.43/psm/CB11011/

i got this error 我得到这个错误

An error occurred

Page not found

Exception information:

Message: Invalid controller specified (psm)

this is my full domain link.. 这是我的完整域链接。

http://172.20.30.43/psm/CB11011/carrental/public/user/register

But if i access in localhost,it look fine. 但是,如果我访问本地主机,它看起来很好。 This is my url for localhost.. 这是我的本地主机网址。

localhost/carrental/public/register

The true controller is "register", not the psm.. for the base url i already add a line into application.ini, this is my code : 真正的控制器是“注册”,而不是psm ..对于基本URL,我已经在application.ini中添加了一行,这是我的代码:

resources.frontController.baseUrl = "http://172.20.30.43/psm/CB11011/carrental/public/"

the problem path for css,js or another include file in layout.phtml look fine. css,js或layout.phtml中另一个包含文件的问题路径看起来不错。 They can link to right path, the only error is zend framework wrong pick my controller.. what should i do guys?? 他们可以链接到正确的路径,唯一的错误是zend framework错误地选择了我的控制器..我该怎么办? i'm sorry for my explaination, i'am new with zend framework, Don't know how to explain well using term in zend framework.. this is my first project using zend framework. 我为我的解释感到抱歉,我是zend框架的新手,不知道如何在zend框架中使用术语进行很好的解释。这是我使用zend框架的第一个项目。

The problem is that your application is in an subfolder in your hosting environment. 问题在于您的应用程序位于宿主环境中的子文件夹中。 This way zend thinks (with this call http://172.20.30.43/psm/CB11011/ ) that it should access the controller psm and call the action CB11011 . 通过这种方式,zend认为(通过此调用http://172.20.30.43/psm/CB11011/ )应该访问控制器psm并调用操作CB11011 Simply change your .htaccess file inside you /public directory. 只需在/public目录中更改.htaccess文件即可。

Something like this (untested!!!) should be fine: 像这样的东西(未经测试!!)应该没问题:

RewriteEngine on
RewriteRule (.*) ./psm/CB11011/$1

And change the path to the frontcontroller inside your application.ini : 并更改application.ini的frontcontroller的路径:

resources.frontController.baseUrl = "/psm/CB11011"

PS: There a some security concerns about putting the whole application into a subfolder, since your controller/modules might be accessible! PS:将整个应用程序放入子文件夹存在一些安全问题,因为您的控制器/模块可以访问!

Try just inserting the following: 尝试仅插入以下内容:

RewriteBase /psm/CB11011

into your .htaccess file, where psm/CB11011 is the subdirectory you moved the application to. 到.htaccess文件中,其中psm / CB11011是将应用程序移至的子目录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM