为什么 codeIgniter 显示在此服务器上未找到请求的 URL?

2022-01-24 00:00:00 url linux debian php codeigniter

我想问.首先,我会告诉我我已经在我的 windows dekstop 上开发了一个使用 codeIgniter 的应用程序.它清晰并完全运行.

I want to ask. First of all, I will tell that I've develop an application use codeIgniter on my windows dekstop. And it clear and run completely.

但是,在我将该项目移至 debian 服务器后,它说:

But, after I move that project to debian server, it said :

The requested URL /index.php/Admin was not found on this server.

我想问,为什么我会得到这样的输出?尽管我使用相同的代码运行了相同的项目.我该如何解决这个问题?

I want to ask, why I got an output like that? Eventhough I ran the same project with the same code. How can I do to fix this issue?

谢谢...

推荐答案

首先启用 mod_rewrite 然后使用以下命令重启 apache2:

First of all enable mod_rewrite then restart apache2 using following commands:

sudo a2enmod rewrite
sudo service apache2 restart

然后使用命令打开 apache conf 文件:

then open apache conf file using command:

sudo gedit /etc/apache2/apache2.conf

如果有注释,请取消注释

uncomment below line if it is commented

AccessFileName .htaccess

然后在 apache2.conf 中找到这些行

then find these lines in apache2.conf

<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted

此处将 AllowOverride None 行更改为 AllowOverride All 并保存此文件.

here change the line AllowOverride None to AllowOverride All and save this file.

现在,您的问题已解决.

Now, your issue is resolved.

相关文章