apache2.2环境下配置伪静态及.htaccess文件详细配置

来源:本站原创 网站开发 超过403人围观 6条评论

配置apache伪静态只需要修改httpd.conf中的两句话

1.把#LoadModule rewrite_module modules/mod_rewrite这句话前面的#去掉;

2.在文件底部添加

<ifmodule mod_rewrite.c>
 RewriteEngine On
 RewriteRule ......#你的伪静态语句
</ifmodule>

但是大多数情况下通过修改httpd.conf里的语句来实现伪静态很繁琐,所以一般通过.htaccess文件来实现;

在apache2.2环境下要使.htaccess起效果,需要修改httpd.conf的一下位置

1.找到以下语句

<Directory />
AllowOverride None
Order deny,allow
Deny from all
</Directory>

修改为

<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all
</Directory>

2.把以下代码之间的AllowOverride none 修改为AllowOverride all,如果不修改此处的话,.htaccess只在磁盘的根目录下起作用,放在网站目录下不会起作用还会出现内部服务器错误

<Directory "你的网站目录">
 #
 # 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>

无觅相关文章插件,快速提升流量

分享到:

携程旅行网-特价机票
版权信息:原创文章:libisky
本文链接:http://libisky.com/?p=405转载请注明转自libisky
如果喜欢:点此订阅本站
  • 相关文章
  • 为您推荐
  • 各种观点
 apache2.2环境下配置伪静态及.htaccess文件详细配置:目前有6 条留言
  1. 很不错,学习下了

    2012-04-25 下午 3:48 回复
  2. 板凳
    猴姆独家:

    来交换链接吧,我先给你链了。

    2012-04-30 下午 10:10 回复
    • libi:

      额,没有啊

      2012-05-04 下午 8:41 回复
  3. 沙发
    猴姆独家:

    链接已经坐上,我的名字是 猴姆独家,咱们合作愉快!

    2012-05-04 下午 8:45 回复
    • libi:

      呃。。。呵呵,我不常看评论。刚计划写篇文章看到的

      2012-05-04 下午 8:49 回复
发表评论

快捷键:Ctrl+Enter