codeigniter删除的index.php给404 erroreindex、codeigniter、php、errore

2023-09-02 09:59:27 作者:此汝子,拿命去珍惜

我把code在.htaccess下的htaccess code和在config.php文件也随之变化,但仍然给了404错误,请任何一个能帮助我找到究竟是什么问题,听见的是链接网站 http://198.12.149.211/~physrec/

  $配置['BASE_URL'] =htt​​p://198.12.149.211/~physrec/;

    < IfModule mod_rewrite.c>
  RewriteEngine叙述上
  的RewriteBase / ci_intro /

    #Removes用户访问到系统文件夹。
    #Additionally这将允许您创建一个System.php控制器,
    #previously这将是不可能。
    #'系统'可以,如果你已重命名系统文件夹进行更换。
的RewriteCond%{REQUEST_URI} ^系统。*
重写规则^(。*)$ /ci_intro/index.php?/$1 [L]

    #当你的应用程序文件夹没有在系统文件夹
    #这个片断prevents用户到应用程序文件夹的访问
    Fabdrol:由#Submitted
    #Rename'应用'为您的应用程序文件夹名称。
的RewriteCond%{REQUEST_URI} ^应用。*
重写规则^(。*)$ /ci_intro/index.php?/$1 [L]

    #Checks,查看是否用户正在试图访问一个有效的文件,
    #such作为图像或CSS文档,如果这不是它发送的真实
    #request的index.php
的RewriteCond%{} REQUEST_FILENAME!-f
的RewriteCond%{} REQUEST_FILENAME!-d
重写规则^(。*)$ /ci_intro/index.php?/$1 [L]


< / IfModule>

<!IfModule mod_rewrite.c>
    #如果我们没有mod_rewrite的安装,所有404的
    #可以被发送到index.php,一切工作正常。
    #提交者:ElliotHaughin

    的ErrorDocument 404的index.php
< / IfModule>
 

解决方案

改变你的.htaccess文件,

  RewriteEngine叙述上
的RewriteCond $ l ^(指数 .PHP | [使用Javascript / CSS /图像根文件夹名称(S)] |机器人 .TXT)!
重写规则^(。*)$ /index.php/$1 [L]
 

这是更改您的配置文件,

  $配置['index_page'] =的index.php;
 
mvc路由原理 php PHP实战002 CodeIgniter安装和入门使用

  $配置['index_page'] =;
 

另外这个例子将是有益的, http://snipplr.com/view/5966/$c$cigniter-htaccess/

i put code in .htaccess under is htaccess code and also change in config.php file but still it gives 404 error please any one help me to find what was the issue in that hear is the link of site http://198.12.149.211/~physrec/

$config['base_url'] = "http://198.12.149.211/~physrec/";

    <IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /ci_intro/

    #Removes access to the system folder by users.
    #Additionally this will allow you to create a System.php controller,
    #previously this would not have been possible.
    #'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /ci_intro/index.php?/$1 [L]

    #When your application folder isn't in the system folder
    #This snippet prevents user access to the application folder
    #Submitted by: Fabdrol
    #Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /ci_intro/index.php?/$1 [L]

    #Checks to see if the user is attempting to access a valid file,
    #such as an image or css document, if this isn't true it sends the
    #request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /ci_intro/index.php?/$1 [L]


</IfModule>

<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin

    ErrorDocument 404 /index.php
</IfModule>   

解决方案

Change your .htaccess file to,

RewriteEngine on
RewriteCond $1 !^(index.php|[Javascript / CSS / Image root Folder name(s)]|robots.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

Change your config file from,

$config['index_page'] = "index.php";

to,

$config['index_page'] = "";

Also this example will be helpfull, http://snipplr.com/view/5966/codeigniter-htaccess/