2012.04
20
apache2.2环境下配置伪静态及.htaccess文件详细配置
配置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>
apache2.2环境下配置伪静态及.htaccess文件详细配置:目前有6 条留言
发表评论



很不错,学习下了
2012-04-25 下午 3:48来交换链接吧,我先给你链了。
2012-04-30 下午 10:10额,没有啊
2012-05-04 下午 8:41@libi 都过了这么多天了
2012-05-04 下午 8:43链接已经坐上,我的名字是 猴姆独家,咱们合作愉快!
2012-05-04 下午 8:45呃。。。呵呵,我不常看评论。刚计划写篇文章看到的
2012-05-04 下午 8:49