腾讯云Ubuntu 14.04 & Apache 2.4.7 $ CI框架 之 如何去掉index.php后缀
来源:互联网 发布:mac终端编辑文件 编辑:程序博客网 时间:2024/06/14 20:30
摘要
CI框架默认有一个index.php作为入口,很讨厌,所以想要把它省略,而腾讯云服务器上我装的是Apache 2.4.7,所以需要配置一下
Apache Rewrite Module
这里需要说一句,想要去找httpd.conf的孩子可以省点心,不要去找了,Ubuntu下的Apache配置文件在/etc/apache2/apache2.conf里面。
sudo a2enmod rewrite
使用这个命令开启rewrite更改/etc/apache2/apache2.conf文件
照着写就对了,主要是* AllowOverride All *
- 去服务器所在目录touch一个.htaccess文件
这里需要注意,比如你的工程在/var/www/html/project里面,那么需要在project文件夹下新建这个文件。
touch .htaccess
注意权限
sudo chmod 777 .htaccess
然后添加如下代码到.htaccess
当服务器在根目录,即var/www/html下时
RewriteEngine on RewriteCond $1 !^(index\.php|images|robots\.txt)RewriteRule ^(.*)$ /index.php/$1 [L]
当服务器不在根目录,即var/www/html/project下时
RewriteEngine on RewriteCond $1 !^(index\.php|images|robots\.txt)RewriteRule ^(.*)$ /project/index.php/$1 [L]
最后记得重启服务器一下
service apache2 restart
然后就可以了。。。。
最后这一部分参考这里
http://blog.csdn.net/qq3559727/article/details/52370771
第一次配置,花了一个多小时,要死了
0 0
- 腾讯云Ubuntu 14.04 & Apache 2.4.7 $ CI框架 之 如何去掉index.php后缀
- 去掉 CI 框架中的 index.php
- CI框架路由去掉index.php
- CI中如何去掉index.php
- CI去掉index.php
- CI去掉index.php
- CI去掉index.php
- CI去掉index.php
- CI框架在Apache服务器下去掉URL中的index.php
- 去掉php框架CI默认url中的index.php
- 去掉php框架CI默认url中的index.php
- PHP CodeIgniter(CI)框架中去掉 index.php方法
- php ci 去掉index.php
- ubuntu16.04apache下去掉CI的index.php
- PHP CI(CodeIgniter) 如何去掉url中的index.php
- CI框架去掉URl中的index.php部分
- 更改CI框架默认访问路径及去掉index.php
- 如何去掉CI (codeigniter)url中的index.php
- Android Gradle Build Error:Some file crunching failed, see logs for details解决办法
- 【单例深思】单例与序列化
- vlc的url中间加上ip
- hdu 5547 Sudoku
- yii2中controller向layout传值
- 腾讯云Ubuntu 14.04 & Apache 2.4.7 $ CI框架 之 如何去掉index.php后缀
- Java 并发编程深入学习——ThreadLocal 原理分析
- sudo apt-get update 与upgrade的用法
- js获取ip地址
- C++primer学习笔记-----4.9~4.10
- Socket编程之非阻塞connect
- 二叉树链式存储
- java字符串的替换replace、replaceAll、replaceFirst的区别详解
- 熟悉链表