在codeigniter present .htaccess文件500错误页面 [英] .htaccess file in codeigniter present a 500 error page

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

问题描述

我刚刚完成我的网站,使用codeigniter,我上传网站到BlueHost的帐户作为一个附加域

我不使用QUERY_STRINGS,这里是它在我的配置文件:

  $配置['enable_query_strings'] = FALSE;
 

该网站会落落的工作以及在我的测试服务器,但它上传到我的BlueHost的帐户,我试图以其他方式浏览任何页面的主页时所面临的一些问题。

这个问题,有设在主机的根另外codeigniter网站,并有.htaccess文件,让它在创建新的网站指向主域名网站中的文件夹时正常工作,所以,我认为,存在的问题与我的插件的网站的.htaccess

这是我的.htaccess的插件网站

 < IfModule mod_rewrite.c>
RewriteEngine叙述上
的RewriteBase /http://www.mydomain.com/

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

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

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

< / IfModule>

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

    的ErrorDocument 404的index.php
< / IfModule>
 

解决方案

感谢everybod,感谢礼你解决它,我加入了DirectoryIndex的,这里是最后的.htaccess文件:

 < IfModule mod_rewrite.c>
RewriteEngine叙述上
的RewriteCond%{} REQUEST_FILENAME!-f
的RewriteCond%{} REQUEST_FILENAME!-d
的RewriteCond $ l ^!(指数\ .PHP |图片|张图片| CSS | JS |机器人\ .TXT)
的RewriteCond $ l ^!(指数\ .PHP |应用程序/视图/ |机器人\ .TXT |安装|图标\ .ICO |文件)
重写规则^(。+)$的index.php?$ 1 [L]
的RewriteBase /
的DirectoryIndex index.php文件


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

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

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

 < / IfModule>

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

的ErrorDocument 404的index.php
< / IfModule>
 

I just finished my website, using codeigniter, i uploaded the site to a bluehost account as an addon domain

i don't use query_strings, and here is where it in my config file:

 $config['enable_query_strings'] = FALSE;

the site is going yo work well in my testing server, but upload it to my bluehost account, i face some issue when trying to navigate any page otherwise the homepage

the problem that there is another codeigniter website located in the root of the host and had .htaccess file to let it work correctly, so when creating new site pointing to a folder inside the main domain site, i think that there is issue with the .htaccess of my addon site

here is my .htaccess for the addon site

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /http://www.mydomain.com/

#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 ^(.*)$ /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 ^(.*)$ /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 ^(.*)$ 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> 

解决方案

Thanks everybod, thanks Eli you solved it, i added the directoryindex and here is the final .htaccess file:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|images|img|css|js|robots\.txt)
RewriteCond $1 !^(index\.php|application/views/|robots\.txt|install|favicon\.ico|documents)
RewriteRule ^(.+)$ index.php?$1 [L]
RewriteBase /
DirectoryIndex index.php


#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 ^(.*)$ /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 ^(.*)$ /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 ^(.*)$ 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> 

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

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