将codeigniter HMVC项目从localhost传输到实时服务器

时间:2022-10-10 10:30:01

I made a web application on codeigniter HMVC. I tested it on local server and the following link works perfectly fine by giving me a login form, the link : http://localhost/bird_vision/users/login, where my directory structure goes like this bird_vision/application/modules/users/users.php (users->module's name, users.php->controller's name). Now I posted the whole "bird_vision" folder to web using filezilla. - changed the base_url in config.php file to domain_name - Made some changes in .htaccess file

我在codeigniter HMVC上创建了一个Web应用程序。我在本地服务器上测试了它,以下链接工作得很好,给我一个登录表单,链接:http:// localhost / bird_vision / users / login,其中我的目录结构就像这个bird_vision / application / modules / users / users.php(users-> module的名称,users.php-> controller的名称)。现在我使用filezilla将整个“bird_vision”文件夹发布到web。 - 将config.php文件中的base_url更改为domain_name - 在.htaccess文件中进行了一些更改

    # Customized error messages.
ErrorDocument 404 /index.php

# Set the default handler.
DirectoryIndex index.php

# Various rewrite rules.
<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?/$10 [L,QSA]
</IfModule>

Now when I write bird_vision.se/bird_vision/users/login in my address bar it gives me 404 page not found. Although when I when type birdvision.se/bird_vision/welcome it gives me welcome to codeigniter page.

现在,当我在地址栏中写下bird_vision.se/bird_vision/users/login时,它找不到404页面。虽然当我输入birdvision.se/bird_vision/welcome时,它给了我欢迎来到codeigniter页面。

Please I need help as my all hardwork making this project is at stake. Thanks in advance.

我需要帮助,因为我的所有努力工作都使这个项目受到威胁。提前致谢。

2 个解决方案

#1


I figured the problem was not with HMVC but was with codeigniter version 3.0. When it comes to unix(which was the operating system running on my server), it is case sensitive. So when I tried to access the controller it could'nt find the file because of case sensitivity and a 404 popped out everytime.

我认为问题不在于HMVC,而在于codeigniter 3.0版。说到unix(在我的服务器上运行的操作系统),它区分大小写。因此,当我尝试访问控制器时,由于区分大小写而无法找到该文件,并且每次都会弹出404。

My folder structure before was something like :

我以前的文件夹结构是这样的:

-application
-->modules
--->users
---->controllers
----->users.php

And the link on which I was getting 404 was www.example.com/users/login

我获得404的链接是www.example.com/users/login

where "users" in the link is controller's name within the "controllers" folder under "modules" folder in my case named as users.php and "login" is the function inside the controller.

其中链接中的“用户”是控制器名称,在“modules”文件夹下的“controllers”文件夹下,在我的情况下命名为users.php,“login”是控制器内部的功能。

All I had to do was to change the case of the first letter of my module and controller name. Now my directory looks like

我所要做的就是更改模块和控制器名称的第一个字母的大小写。现在我的目录看起来像

-application
-->modules
--->Users
---->controllers
----->Users.php

note : capitalized "U" in Users module and Users controller.

注意:Users模块和Users控制器中的大写“U”。

And the the url I used to access the users controller was : www.example.com/Users/login

我用来访问用户控制器的网址是:www.example.com/Users/login

And I was back in business.

我又回来了。

#2


You saved me Zeeshan Cornelius

你救了我Zeeshan Cornelius

I was struggling for more than 30 minutes finally made it working. thanks a lot

我奋力超过30分钟终于让它发挥作用。非常感谢

#1


I figured the problem was not with HMVC but was with codeigniter version 3.0. When it comes to unix(which was the operating system running on my server), it is case sensitive. So when I tried to access the controller it could'nt find the file because of case sensitivity and a 404 popped out everytime.

我认为问题不在于HMVC,而在于codeigniter 3.0版。说到unix(在我的服务器上运行的操作系统),它区分大小写。因此,当我尝试访问控制器时,由于区分大小写而无法找到该文件,并且每次都会弹出404。

My folder structure before was something like :

我以前的文件夹结构是这样的:

-application
-->modules
--->users
---->controllers
----->users.php

And the link on which I was getting 404 was www.example.com/users/login

我获得404的链接是www.example.com/users/login

where "users" in the link is controller's name within the "controllers" folder under "modules" folder in my case named as users.php and "login" is the function inside the controller.

其中链接中的“用户”是控制器名称,在“modules”文件夹下的“controllers”文件夹下,在我的情况下命名为users.php,“login”是控制器内部的功能。

All I had to do was to change the case of the first letter of my module and controller name. Now my directory looks like

我所要做的就是更改模块和控制器名称的第一个字母的大小写。现在我的目录看起来像

-application
-->modules
--->Users
---->controllers
----->Users.php

note : capitalized "U" in Users module and Users controller.

注意:Users模块和Users控制器中的大写“U”。

And the the url I used to access the users controller was : www.example.com/Users/login

我用来访问用户控制器的网址是:www.example.com/Users/login

And I was back in business.

我又回来了。

#2


You saved me Zeeshan Cornelius

你救了我Zeeshan Cornelius

I was struggling for more than 30 minutes finally made it working. thanks a lot

我奋力超过30分钟终于让它发挥作用。非常感谢