Php 在Ubuntu13.10上从XAMPP移动到LAMP后,htaccess不工作(在ApacheLinux服务器上启用htaccess)

Php 在Ubuntu13.10上从XAMPP移动到LAMP后,htaccess不工作(在ApacheLinux服务器上启用htaccess),php,.htaccess,redirect,ubuntu,lamp,Php,.htaccess,Redirect,Ubuntu,Lamp,我的CodeIgniter项目正在使用url在我的XAMPP系统上成功运行 http://localhost/newsfeeds/users/allCategories/ 当我把这个项目转移到另一个系统时,Ubuntu 13.10上有LAMP服务器。要运行同一页面,我需要url http://localhost/newsfeeds/index.php/users/allCategories/ 我需要index.php文件,否则它会显示一个页面错误 我的htaccess文件是 RewriteE

我的CodeIgniter项目正在使用url在我的XAMPP系统上成功运行

http://localhost/newsfeeds/users/allCategories/
当我把这个项目转移到另一个系统时,Ubuntu 13.10上有LAMP服务器。要运行同一页面,我需要url

http://localhost/newsfeeds/index.php/users/allCategories/
我需要index.php文件,否则它会显示一个页面错误

我的htaccess文件是

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
如何在WAMPP和XAMP服务器上运行同一个没有index.php的项目?

尝试以下方法:

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]

我找到了解决这个问题的办法

在我的服务器中,模式重写已打开。但是需要在
/etc/apache2/apache2.conf
文件中更改一些默认值。以下是我的变化

首先,找到

<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
然后重新启动服务器

$ sudo /etc/init.d/apache2 restart

运行项目。工作正常。

是否启用了重写模块?@Rufinus是的,当
.htaccess
文件移到LAMP服务器时,是否启用了重写模块?
是否允许对htdocs目录执行全部
?error.log?@SverriM.Olsen中有任何消息吗?@htaccess文件也在LAMP中
$ sudo /etc/init.d/apache2 restart