[英]Codeigniter mod_rewrite gives server 500 error
I get an server 500 error with this htaccesss file in my xampp enviorment. 在我的xampp环境中,此htaccesss文件出现服务器500错误。
My $config['index_page']
variable is set to ''
我的
$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>
So if I go to localhost/codeigniter_test/site/home
now I get this server 500 error. 因此,如果现在我转到
localhost/codeigniter_test/site/home
则会收到此服务器500错误。
site = controller
and home = function in the site controller which loads up the home view
site = controller
, home = function in the site controller which loads up the home view
Also localhost/codeigniter_test/site/about
is not working for me. 另外
localhost/codeigniter_test/site/about
对我不起作用。 I don't get any 404 page so this means my mod_rewrite
module is enabled. 我没有任何404页面,因此这意味着我的
mod_rewrite
模块已启用。 I also checked this in my httpd.conf
file. 我也在我的
httpd.conf
文件中检查了这一点。
Apache logs says: Apache日志说:
[core:alert] [pid 1484:tid 512] [client 127.0.0.1:3870] C:/xampp/htdocs/codeigniter_test/.htaccess:
[core:alert] [pid 1484:tid 512] [client 127.0.0.1:3870] C:/xampp/htdocs/codeigniter_test/.htaccess:
Edit: So I just removed the entire IF part. 编辑:所以我只是删除了整个中频部分。 Now localhost/codeigniter_test/ works.
现在localhost / codeigniter_test /可以使用了。 But if I go to localhost/codeigniter_test/site/home it doesnt work and I get an 404 page.
但是,如果我转到localhost / codeigniter_test / site / home,它将无法正常工作,并且会显示404页面。
Edit2: I change AllowOverride None to AllowOverride All in my httpd conf file. Edit2:我在httpd conf文件中将AllowOverride None更改为AllowOverride All。 Now I get a 403 error when I go to: localhost/codeigniter_test/site/home/
现在,当我转到以下位置时,出现403错误:localhost / codeigniter_test / site / home /
"The requested URL /codeigniter_test/site/home was not found on this server." “在此服务器上找不到请求的URL / codeigniter_test / site / home。”
I got similar issue, basically, it's a permission issue: 我遇到了类似的问题,基本上,这是一个权限问题:
try granting 755 permission on the folders and subfolders 尝试授予文件夹和子文件夹755的权限
chmod 755 *
chmod 755 */*
chmod 755 */*/*
chmod 755 */*/*/*
chmod 755 */*/*/*/*
I only have this in my .htaccess file 我的.htaccess文件中只有这个
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
Hope that helps 希望能有所帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.