Apache2如何支持.htaccess

今天刚刚搞明白如何在自己的机器上实现.htaccess的重定向功能,并且还欣喜地发现原来我使用的空间也支持.htaccess,并立刻将自己的blog加了一套url重定向,喜悦阿,现在看到每一个原来的页面地址后缀由“?P=XXX”变为“XXX.html”心里那个美啊,:-)

其实在本地机实现.htaccess也很简单,但像我这样的apache菜鸟,没高人指点还真要费点心思。查到很多资料,都是适用于apache1系列的,整整适用于apache2的文章资料很少,具体方法如下:

主要修改apache安装文件夹conf下的httpd.conf文件

  1. 将“#LoadModule rewrite_module modules/mod_rewrite.so”前面的#号去掉
  2. 将“Options Indexes FollowSymLinks … AllowOverride None”改为“Options Indexes FollowSymLinks … AllowOverride All
  3. 将“Options Indexes FollowSymLinks … AllowOverride All”所在的“Directory”目录改为你的网页根目录,例如我的是“G:/php/www”,那“Directory”就改为“< Directory “G:/php/www”>”
  4. 重新启动apache服务器,大功告成!
<script type="text/javascript"> </script> <script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript">  </script> width="234" scrolling="no" height="60" frameborder="0" allowtransparency="true" hspace="0" vspace="0" marginheight="0" marginwidth="0" src="http://pagead2.googlesyndication.com/pagead/ads?client=ca-pub-8176397236551093&dt=1195109635734&lmt=1195109632&prev_fmts=468x60_as&output=html&slotname=5168566147&correlator=1195109635734&url=http%3A%2F%2Fwww.silbo.net%2F556.html&ref=http%3A%2F%2Fwww.baidu.com%2Fs%3Fwd%3Dapache2%2B%2B.htaccess%26cl%3D3&cc=100&ga_vid=1017088412.1195109636&ga_sid=1195109636&ga_hid=326974240&ga_fc=true&flash=9&u_h=800&u_w=1280&u_ah=770&u_aw=1280&u_cd=32&u_tz=480&u_his=1&u_java=true&u_nplug=16&u_nmime=78" name="google_ads_frame" style="display: none;">
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值