apache2.2.21下为codeigniter配置url地址重写
2012-10-27 00:38
465 查看
apache2.2.21下为codeigniter配置url地址重写
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 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,搞定。
相关文章推荐
- wamp win2003 drupal配置apache下url地址重写
- apache2.2.21下配置url地址重写 去掉index.php
- 配置.htaccess文件实现URL地址重写
- Ecshop url重写 apache环境配置伪静态
- apache url路由配置重写
- Apache常用地址重写配置
- apache的url_rewrite地址重写中得到问号后面的参数
- Apache & nginx 的地址重写 url_rewrite,省略 index.php
- ASP.NET的URL地址重写(伪静态)示例配置
- codeigniter在nginx安装配置及URL重写
- Apache配置之url重写
- Apache的URL地址重写(RewriteCond与RewriteRule)
- codeigniter 在 nginx 下的 pathinfo url 重写配置
- apache url路由配置重写
- apache url重写的问题 简化url地址
- 通过Apache的URL地址重写(附伪静态方式)
- apache配置URL重写
- nginx 配置web 虚拟文件夹 而且codeIgniter,thinkphp 重定向url 地址
- Apache中URL地址重写
- 解决URL中包含“%2F”导致Apache地址重写mod_rewrite失效的问题