【发布时间】:2014-07-02 07:55:16
【问题描述】:
我正在上传使用 codeigniter 构建的新网站。
但它给出了内部 500 服务器错误。
我不知道,如何通过htaccess代码在服务器上启用re-write模块,如何通过htaccess代码在服务器上启用apache mode_rewrite?
php_value upload_max_filesize 20M
php_value post_max_size 20M
php_value max_execution_time 90
php_value max_input_time 300
# Make sure directory listing is disabled
Options +FollowSymLinks -Indexes
# disable the Apache MultiViews directive if it is enabled on the server. It plays havoc with URL rewriting
Options -MultiViews
RewriteEngine on
# NOTICE: If you get a 404 play with combinations of the following commented out lines
#AllowOverride All
#RewriteBase /wherever/pyro/is
# Restrict your site to only one domain
# !important USE ONLY ONE OPTION
# Option 1: To rewrite "www.domain.com -> domain.com" uncomment the following lines.
#RewriteCond %{HTTPS} !=on
#RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
#RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
# Option 2: To rewrite "domain.com -> www.domain.com" uncomment the following lines.
#RewriteCond %{HTTPS} !=on
#RewriteCond %{HTTP_HOST} !^www\..+$ [NC]
#RewriteCond %{HTTP_HOST} (.+)$ [NC]
#RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L]
# Keep people out of codeigniter directory and Git/Mercurial data
RedirectMatch 403 ^/(system\/cms\/cache|system\/codeigniter|\.git|\.hg).*$
# Send request via index.php (again, not if its a real file or folder)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
<IfModule mod_php5.c>
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
<IfModule !mod_php5.c>
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
</ IfModule>
【问题讨论】:
-
HTTP 500 错误调试应始终在您的 Web 服务器错误日志中开始。它可能与重写规则完全无关。
-
阅读 Apache error.log 并告诉我们您在那里看到的实际错误。
标签: php apache .htaccess codeigniter mod-rewrite