2014-07-01 69 views
0

我在Windows上编写我的web应用程序,并将其推送到运行Ubuntu Linux的服务器。这里是我的.htaccess文件:500内部服务器错误CodeIgniter htaccess mod_rewrite

<IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteBase /SearchDatGifUbuntu/ 
    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. 
    ErrorDocument 404 /index.php 
</IfModule> 

我在文件/ etc/apache2的/网站可用/默认如下:

<Directory /var/www/> 
    Options Indexes FollowSymLinks MultiViews 
    AllowOverride All 
    Order allow,deny 
    allow from all 
</Directory> 

我输入sudo的a2enmod改写成在我的Ubuntu的命令行服务器,它说mod_rewrite已经打开。

当我通过我的笨应用程序调试,似乎是错误出现在CodeIgniter.php线308,这就是:

$CI = new $class(); 

可有人请让我知道是怎么回事?

+0

尝试'AllowOverride FileInfo'而不是'Require all granted',http://stackoverflow.com/a/22526144/661872 –

回答

3
RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php/$1 [L] 

试试这个的.htaccess代码,并重新启动你的Apache

如果这不起作用,请尝试此链接

How to enable mod_rewrite for Apache 2.2

0

我不得不编辑:

的/ etc /apache2/apache2.conf

and set:

<Directory /var/www/html> 
    # ... other directives... 
    AllowOverride All 
</Directory> 

然后重新启动apache,以便读取上述.htaccess代码。