codeigniter网站404错误/的.htaccess [英] Codeigniter website 404 error / .htaccess

查看:203
本文介绍了codeigniter网站404错误/的.htaccess的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用codeigniter,我建立一个小型Web的工作正常,在当地,但是当我上传到我的免费托管(的 http://www.hostinger.es )则不起作用。我想这是因为htaccess的,我阅读和尝试一些htaccess的配置,但仍然不能正常工作。

我的codeIgniter proyect是MYDOMAIN /管理,因为网络的其他部分并不codeigniter:

我的config.php的某些选项

  $配置['BASE_URL'] ='http://whereis.hol.es/admin';
$配置['index_page'] ='';
$配置['uri_protocol'] ='自动';
$配置['url_suffix才能'] ='html的;
 

和我最后的.htaccess,我试图得到尽可能简单理解它。

  RewriteEngine叙述上
的RewriteCond $ l ^(指数\ .PHP |图片|瑞士法郎|上传| JS | CSS |机器人\ .TXT)!
重写规则^(。*)$ /index.php/$1 [L]
 

这是我第一次与htaccess的文件,我在阅读中学习,但我不能让我的网络联机。我不知道,知道在哪里把.htaccess文件: - 我的网站/ - 我的codeigniter /(管理员) - 应用程序codeigniter文件夹(管理/应用程序)

PD:当我尝试加载管理重定向到我的控制器登录,但显示404错误:     404找不到网页

 您请求的页面没有被发现。
 

解决方案

使用下面的code。在你的.htaccess文件

  RewriteEngine叙述上
的RewriteCond%{REQUEST_URI} ^ /系统。*
重写规则^(。*)$的index.php?/ $ 1 [L]
的RewriteCond%{} REQUEST_FILENAME!-f
的RewriteCond%{} REQUEST_FILENAME!-d
重写规则^(。+)$的index.php?/ $ 1 [L]
 

I'm trying with codeigniter, I build a small web that working fine in local but when I uploaded to my free hosting (http://www.hostinger.es) then don't work. I think it is because the .htaccess and I'm reading and trying some .htaccess configurations but still don't work.

My CodeIgniter proyect is in mydomain/admin because the rest of web is not codeigniter:

Some options of my config.php

$config['base_url'] = 'http://whereis.hol.es/admin';
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';
$config['url_suffix'] = '.html';

And my last .htaccess, I'm try to get simple as possible to understand it.

RewriteEngine on
RewriteCond $1 !^(index\.php|images|swf|uploads|js|css|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

It's my first time with htaccess files, I'm reading to learn, but I can't get my web online. I don't know sure where put the .htaccess file: - / of my website - / of my codeigniter (admin) - application codeigniter folder (admin/application)

PD: When I try to load admin it redirect to my controller Login but show a 404 error: 404 Page Not Found

The page you requested was not found.

解决方案

Use the following code in your .htaccess file

RewriteEngine On
RewriteCond %{REQUEST_URI} ^/system.*
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?/$1 [L]

这篇关于codeigniter网站404错误/的.htaccess的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆