我正在使用CodeIgniter框架开发项目,当我从Xampp运行我的项目时,它显示500内部服务器错误。如何在CodeIgniter框架中解决Error 500或者是htaccess文件的错误?
SetEnv MAGIC_QUOTES 0
SetEnv PHP_VER 5
Options -Indexes
Options +FollowSymLinks
DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /aip
RewriteCond %{REQUEST_URI} ^base.*
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{HTTP_HOST} ^(dishme\.com\.au)$ [NC]
RewriteRule ^ https://www.%1%{REQUEST_URI} [L,R=301,NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|images|css|fonts|woff|ttf|eot|svg|robots\.txt|favicon\.ico)
RewriteRule ^(.*)$ /aip/index.php?/$1 [L]
#Block libwww-perl attacks
RewriteCond %{HTTP_USER_AGENT} libwww-perl.*
RewriteRule .* ? [F,L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
<IfModule mod_expires.c>
ExpiresActive on
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
</IfModule>
# compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
答案 0 :(得分:3)
使用此htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>