找不到对象! codeigniter项目中的错误404

时间:2022-10-09 14:58:43

I have seen similar questions asked by other users but none has worked for me. I have a CodeIgniter project which runs perfectly fine in my localhost. I created virtual hosts so that I can host many projects. I do get the first page (login page) of the site but when logging into the system I get the error shown below instead of the next valid page.

我见过其他用户提出的类似问题,但没有一个对我有用。我有一个CodeIgniter项目,在我的localhost中运行得很好。我创建了虚拟主机,以便我可以托管许多项目。我确实得到了网站的第一页(登录页面),但登录系统后,我得到的错误显示在下面而不是下一个有效页面。

Object not found! The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error. If you think this is a server error, please contact the webmaster. Error 404 127.0.0.1 Apache/2.4.10 (Win32) OpenSSL/1.0.1i PHP/5.6.3

找不到对象!在此服务器上找不到请求的URL。引用页面上的链接似乎是错误的或过时的。请通知该页面的作者有关错误的信息。如果您认为这是服务器错误,请与网站管理员联系。错误404 127.0.0.1 Apache / 2.4.10(Win32)OpenSSL / 1.0.1i PHP / 5.6.3

This is the error log from www/site/log.../

这是www / site / log ... /的错误日志

[Sat May 09 01:10:30.703354 2015] [core:error] [pid 5060:tid 1680] [client 127.0.0.1:57053] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
[Sat May 09 01:10:30.703354 2015] [core:error] [pid 5060:tid 1680] [client 127.0.0.1:57053] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
[Sat May 09 01:10:30.703354 2015] [core:error] [pid 5060:tid 1680] [client 127.0.0.1:57058] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
[Sat May 09 01:10:30.703354 2015] [core:error] [pid 5060:tid 1680] [client 127.0.0.1:57058] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.

and my .htaccess file

和我的.htaccess文件

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteBase /accounting/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

My virtual host settings:

我的虚拟主机设置:

NameVirtualHost *:80
<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs"
    ServerName localhost
</VirtualHost>
<VirtualHost *:80>
    DocumentRoot "C:/www/saseco"
    ServerName saseco.dev
    ServerAlias www.saseco.dev
    CustomLog "C:/www/saseco/logs/saseco.local.access.log" combined
    ErrorLog "C:/www/saseco/logs/saseco.local.error.log"
    <Directory "C:/www/saseco">
        AllowOverride All
        Require all Granted
    </Directory>
</VirtualHost>

Partial snippet of my login controller:

我的登录控制器的部分片段:

function user_login()
    {
        if(isset($_POST['enter']))  //Login button pressed
        {
            $data = $_POST;
            $check = $this->login_model->login_match($data);

Can someone tell me where I have gone wrong?

谁能告诉我哪里出错了?

2 个解决方案

#1


Ok, so in the code you have not shown us - you need to change it where it's creating http://127.0.0.1/saseco/login/user_login and make it generate http://www.saseco.dev/login/user_login As those are two very different locations according to your vhost setup.

好的,所以在您没有向我们展示的代码中 - 您需要在创建http://127.0.0.1/saseco/login/user_login的位置更改它并使其生成http://www.saseco.dev/login/user_login根据您的vhost设置,这些是两个非常不同的位置。

So you would need to have something like <?php echo base_url('login/user_login');?> And make sure that in your /application/config/config.php you have $config['base_url'] correctly configured. Try

所以你需要像 并确保你的/application/config/config.php中正确配置了$ config ['base_url']。尝试

$config['base_url'] = '';

Or hardcode it to

或硬编码

$config['base_url'] = 'http://www.saseco.dev/';

Additional: Not sure why you have your RewriteBase set to accounting so try changing

附加:不确定为什么你的RewriteBase设置为会计,所以尝试更改

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /accounting/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

To

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

#2


<?

?>

Try this instead:

试试这个:

<?php 

?>

It worked for me.

它对我有用。

#1


Ok, so in the code you have not shown us - you need to change it where it's creating http://127.0.0.1/saseco/login/user_login and make it generate http://www.saseco.dev/login/user_login As those are two very different locations according to your vhost setup.

好的,所以在您没有向我们展示的代码中 - 您需要在创建http://127.0.0.1/saseco/login/user_login的位置更改它并使其生成http://www.saseco.dev/login/user_login根据您的vhost设置,这些是两个非常不同的位置。

So you would need to have something like <?php echo base_url('login/user_login');?> And make sure that in your /application/config/config.php you have $config['base_url'] correctly configured. Try

所以你需要像 并确保你的/application/config/config.php中正确配置了$ config ['base_url']。尝试

$config['base_url'] = '';

Or hardcode it to

或硬编码

$config['base_url'] = 'http://www.saseco.dev/';

Additional: Not sure why you have your RewriteBase set to accounting so try changing

附加:不确定为什么你的RewriteBase设置为会计,所以尝试更改

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /accounting/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

To

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

#2


<?

?>

Try this instead:

试试这个:

<?php 

?>

It worked for me.

它对我有用。