在 ubuntu 13.10 上从 XAMPP 移动到 LAMP 后,htaccess 不起作用(在 apache linux 服务器中启用 htaccess) [英] htaccess is not working after moving from XAMPP to LAMP on ubuntu 13.10 (Enable htaccess in apache linux server)

查看:29
本文介绍了在 ubuntu 13.10 上从 XAMPP 移动到 LAMP 后,htaccess 不起作用(在 apache linux 服务器中启用 htaccess)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

My CodeIgniter project is running successfully on my XAMPP system with the url,

http://localhost/newsfeeds/users/allCategories/

当我将这个项目移动到另一个系统时,在 Ubuntu 13.10 上有 LAMP 服务器.要运行相同的页面,我需要网址,

When I move this project to another system has LAMP server on Ubuntu 13.10. To run the same page I need the url,

http://localhost/newsfeeds/index.php/users/allCategories/

我需要 index.php 文件,否则它会显示页面未找到错误.

I need the index.php file otherwise it shows a page not fount error.

我的 htaccess 文件是,

My htaccess file is,

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

如何在没有 index.php 的情况下在 WAMPP 和 XAMP 服务器上运行同一个项目?

How can I run the same project without index.php on both WAMPP and XAMP server ?

推荐答案

我找到了这个问题的解决方案.

I found the solution for this issue.

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

In my server the mode rewrite is already on. But some default values need to be change on /etc/apache2/apache2.conf file. Following are my changes,

首先找到

<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>

并将 AllowOverride None 更改为 All 并保存.

And change AllowOverride None to All and save.

然后使用命令启用模式重写(在这种情况下已经启用),

Then enable mode rewrite using the command(In this case already enabeled),

$ sudo a2enmod rewrite

然后重启服务器,

$ sudo /etc/init.d/apache2 restart

运行项目.工作正常.

这篇关于在 ubuntu 13.10 上从 XAMPP 移动到 LAMP 后,htaccess 不起作用(在 apache linux 服务器中启用 htaccess)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆