Codeigniter mod_rewrite给出服务器500错误

时间:2013-07-15 10:59:48

标签: php codeigniter

我的xampp环境中的htaccesss文件出现服务器500错误。

我的$config['index_page']变量设置为''

C:/xampp/htdocs/codeigniter_test/.htaccess

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

#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> 

因此,如果我现在转到localhost/codeigniter_test/site/home,我会收到此服务器500错误。

site = controllerhome = function in the site controller which loads up the home view

同样localhost/codeigniter_test/site/about对我不起作用。 我没有得到任何404页面,所以这意味着我的mod_rewrite模块已启用。 我还在httpd.conf文件中检查了这个。

Apache日志说:

  

[core:alert] [pid 1484:tid 512] [client 127.0.0.1:3870] C:/xampp/htdocs/codeigniter_test/.htaccess:

编辑:所以我刚删除了整个IF部分。 现在localhost / codeigniter_test /工作。 但是,如果我去localhost / codeigniter_test / site / home它不起作用,我得到一个404页面。

Edit2:我在httpd conf文件中将AllowOverride None更改为AllowOverride All。 现在,当我访问:localhost / codeigniter_test / site / home /

时,我收到403错误

“在此服务器上找不到请求的URL / codeigniter_test / site / home。”

1 个答案:

答案 0 :(得分:0)

我遇到了类似的问题,基本上,这是一个许可问题:

尝试对文件夹和子文件夹授予755权限

chmod 755 *
chmod 755 */*
chmod 755 */*/*
chmod 755 */*/*/*
chmod 755 */*/*/*/*

我只在我的.htaccess文件中有这个

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]

希望有所帮助

相关问题