codeigniter URL重写的.htaccess不工作在CentOS [英] Codeigniter URL rewriting .htaccess is not working on CentOS

查看:208
本文介绍了codeigniter URL重写的.htaccess不工作在CentOS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在的/ var / www / html等/ 创建我的文档根目录.htaccess文件改写codeigniter URL删除的index.php 所有网页的URL。

I've created a .htaccess file in my document root at /var/www/html/ to rewrite URL of Codeigniter to remove "index.php" from URL of all pages.

例如。从更改网址

http://myhost/index.php/controller/function

http://myhost/controller/function`

下面是我的`/var/www/html/.htaccess的code

Here is the code of my `/var/www/html/.htaccess

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

我已经得到了很多建议,从谷歌上搜索,使mod-rewrite模块,但我可以看到我的的httpd.conf 其已经启用。

LoadModule rewrite_module modules/mod_rewrite.so

这完全致力于在Debian 7(阿帕奇/ 2.4.4),我的本地系统上运行的。

This is perfectly working on my local system running on Debian 7 (Apache/2.4.4).

任何帮助将是AP preciated。 :)

Any help would be appreciated. :)

推荐答案

您还需要指定,可以使用它的位置。例如,在/etc/httpd/conf/httpd.conf中你应该看到类似:

You need to also specify the locations that can use it. For example, in /etc/httpd/conf/httpd.conf you should see something like:

<Directory "/var/www/html">

      ...lots of text...

</Directory>

确认是有:

<Directory "/var/www/html">

    AllowOverride All

</Directory>

这篇关于codeigniter URL重写的.htaccess不工作在CentOS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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