apache2.2.21下配置url地址重写 去掉index.php
来源:互联网 发布:seo文章内链 编辑:程序博客网 时间:2024/05/16 11:47
1、首先打开apache的配置文件,httpd.conf,
找到#LoadModule rewrite_module modules/mod_rewrite.so,去掉前面的#号,开启mod_rewrite模块
2、找到
<Directory /> Options FollowSymLinks AllowOverride none Order deny,allow Deny from all</Directory>
修改为:
<Directory /> Options FollowSymLinks AllowOverride All Order deny,allow Deny from all</Directory>
3、找到
<Directory "D:/Program Files (x86)/Web/www">
# # Possible values for the Options directive are "None", "All", # or any combination of: # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews # # Note that "MultiViews" must be named *explicitly* --- "Options All" # doesn't give it to you. # # The Options directive is both complicated and important. Please see # http://httpd.apache.org/docs/2.2/mod/core.html#options # for more information. # Options Indexes FollowSymLinks # # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # Options FileInfo AuthConfig Limit # AllowOverride none # # Controls who can get stuff from this server. # Order allow,deny Allow from all</Directory>
修改为:
<Directory "D:/Program Files (x86)/Web/www"> # # Possible values for the Options directive are "None", "All", # or any combination of: # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews # # Note that "MultiViews" must be named *explicitly* --- "Options All" # doesn't give it to you. # # The Options directive is both complicated and important. Please see # http://httpd.apache.org/docs/2.2/mod/core.html#options # for more information. # Options Indexes FollowSymLinks # # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # Options FileInfo AuthConfig Limit # AllowOverride All # # Controls who can get stuff from this server. # Order allow,deny Allow from all</Directory>
以上主要是修改 AllowOverride one为 AllowOverride All
4、打开你的ci目录的application/config下的config.php,查找$config['index_page']变量,将它的值留空
5、为ci编写.htaccess文件,站长的CI安装在网站根目录的friend目录下,应此.htaccess的内容如下:
<IfModule mod_rewrite.c>RewriteEngine onRewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_FILENAME} !-fRewriteRule ^(.*)$ /friend/index.php/$1 [QSA,PT,L]</IfModule>
如果你的ci就是安装在网站根目录,那么,你的.htaccess内容应该为:
<IfModule mod_rewrite.c>RewriteEngine onRewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_FILENAME} !-fRewriteRule ^(.*)$ /index.php/$1 [QSA,PT,L]</IfModule>
嗯,相信大家都看出区别了,就是多了一个ci的安装目录,但是却很重要。
6、重启apache,搞定。
- apache2.2.21下配置url地址重写 去掉index.php
- 使用URL重写,去掉index.php
- yii url重写去掉index.php
- Yii+Apache url重写去掉index.php
- windows2003 PHP IIS URL重写去掉index.php
- nginx 重写去掉index.php
- nginx 重写去掉index.php
- url中去掉index.php
- 去掉 URL 中的 index.php
- URL如何去掉index.php
- URL重写 省略index.php
- thinkphp在wamp 配置去掉url中index.php方法
- CI在nginx环境下去掉url中的index.php
- ThinkPHP 在nginx环境下去掉URL中的index.php
- Apache下简化URL,去掉index.php的方法
- Yii1.1 优化URL之去掉index.php(ubuntu Apache2)
- [PHP]去掉CodeIgniter URL中的index.php
- php 去掉Url里的 index.php
- poj 1704 #博弈 转化为取石子
- C++程序中支持SMTP邮件发送的解决方案荟萃
- [JAVA工具]判断字符串是否为中文
- 重拾旧河山~
- 打印出数组的所有子集
- apache2.2.21下配置url地址重写 去掉index.php
- C++静态成员函数小结(转)
- (莱昂氏unix源代码分析导读-47) exec
- VC++6.0调试出错 One or more breakpoints cannot be set and have been disabled...
- 左手手型投篮姿势教程
- PHP的SMS Server Tools 3驱动网管程序
- 读取国航三字码的PROPERTIES
- PHP相关系列 - PHP缓存使用的一个陷阱
- thrift