簡體   English   中英

Codeigniter mod_rewrite給服務器500錯誤

[英]Codeigniter mod_rewrite gives server 500 error

在我的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:

編輯:所以我只是刪除了整個中頻部分。 現在localhost / codeigniter_test /可以使用了。 但是,如果我轉到localhost / codeigniter_test / site / home,它將無法正常工作,並且會顯示404頁面。

Edit2:我在httpd conf文件中將AllowOverride None更改為AllowOverride All。 現在,當我轉到以下位置時,出現403錯誤:localhost / codeigniter_test / site / home /

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

我遇到了類似的問題,基本上,這是一個權限問題:

嘗試授予文件夾和子文件夾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]

希望能有所幫助

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM