apache2.2.21下配置url地址重写 去掉index.php
2012-07-24 12:28
567 查看
1、首先打开apache的配置文件,httpd.conf,
找到#LoadModule rewrite_module modules/mod_rewrite.so,去掉前面的#号,开启mod_rewrite模块
2、找到
找到#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 on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ /friend/index.php/$1 [QSA,PT,L] </IfModule>
如果你的ci就是安装在网站根目录,那么,你的.htaccess内容应该为:
<IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ /index.php/$1 [QSA,PT,L] </IfModule>
嗯,相信大家都看出区别了,就是多了一个ci的安装目录,但是却很重要。
6、重启apache,搞定。
相关文章推荐
- Apache & nginx 的地址重写 url_rewrite,省略 index.php
- 修改apache配置文件去除thinkphp url中的index.php
- 修改apache配置文件去除thinkphp url中的index.php
- .htaccess文件配置(去掉url里面的index.php)无效url后面加/
- Apache下简化URL,去掉index.php的方法
- 修改apache配置文件去除thinkphp url中的index.php(转)
- Magento 去掉URL地址中的index.php字符串[ubuntu]
- 修改apache配置文件去除thinkphp url中的index.php
- apache配置rewrite规则,删除url中的index.php
- CI框架apache和nginx环境下面统一去掉路径URL后面的index.php
- thinkphp项目在apache服务器中“去掉”index.php后出现找不到url的问题
- thinkphp在wamp 配置去掉url中index.php方法
- CI框架在Apache服务器下去掉URL中的index.php
- apache 配置rewrite模块,URL中隐藏index.php
- ThinkPHP如何URL如何去掉index.php(重写模式)
- 修改apache配置文件去除thinkphp url中的index.php
- apache2.2.21下为codeigniter配置url地址重写
- 在Apache及IIS6.0中codeigniter去掉 URL 中的 index.php
- 在Apache及IIS6.0中codeigniter去掉 URL 中的 index.php
- 在Apache2.2.16中配置CodeIgniter2.0,去掉index.php实现简洁链接