启用mod_rewrite模块
在conf目录的httpd.conf文件中找到
LoadModule rewrite_module modules/mod_rewrite.so
将这一行前面的#去掉。
2.在要支持url rewirte的目录启用 Options FollowSymLinks和AllowOverride All
Alias /php "c:/web/php/"
<Directory "c:/web/php/">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
这样通过http://localhost:8080/php/访问时,/php/和其下面的子目录将支持url rewrite。


后记:php100.com
网上的很多文章并没有提到要使用 Options FollowSymLinks,因为在httpd.conf中有

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


这样如果你的网站配置成通过http://localhost:8080/来访问,就不会注意到Options FollowSymLinks的影响,只需要将AllowOverride None改为AllowOverride All即可。而我习惯于在本机配置成http://localhost:8080/php/,忘了加Options Indexes FollowSymLinks就成功不了,会显示
Forbidden
You don't have permission to access /php/f2blog/ on this server.
这样的错误。后来还是在apache文档中找到了原因
Note: To enable the rewriting engine for per-directory configuration files you need to set ``RewriteEngine On'' in these files and ``Options FollowSymLinks'' must be enabled. If your administrator has disabled override of FollowSymLinks for a user's directory, then you cannot use the rewriting engine. This restriction is needed for security reasons.
实际上mod_rewrite是针对目录的,因此并不需要将httpd.conf中的所有AllowOverride None改为AllowOverride All,Options也一样。
BTW:看来首先是要看程序提供的文档,但是tomcat5.0.28的文档我几乎都看了,也没有看到说到底能不能通过service.bat在windows上安装成功服务。倒是看到N多人和我一样的疑问却没有答案,嗯,我当然知道通过tomcatxx.exe能安装成功tomcat服务,看来只有这一条路了。






width="468" height="60" id="iframe168229_0" src="http://pos.baidu.com/ocim?sz=468x60&rtbid=2053463&rdid=9223372032564345876&dc=2&di=168229&dri=0&dis=0&dai=1&ps=1502x170&dcb=BAIDU_SSP_define&dtm=BAIDU_DUP_SETJSONADSLOT&dvi=0.0&dci=-1&dpt=none&tsr=0&tpr=1460075812389&ti=%E5%BC%80%E5%90%AFApache%20mod_rewrite%E6%A8%A1%E5%9D%97%E5%AE%8C%E5%85%A8%E8%A7%A3%E7%AD%94&ari=1&dbv=0&drs=3&pcs=1261x617&pss=1261x1520&cfv=20&cpl=0&chi=1&cce=true&cec=gb2312&tlm=1453018516&ltu=http%3A%2F%2Fwww.php100.com%2Fhtml%2Fwebkaifa%2Fapache%2F2010%2F0228%2F4006.html&ltr=http%3A%2F%2Fwww.baidu.com%2Flink%3Furl%3DBecgRE7R_MjQ5CW8DUctmb6_uRh4Lsx_abNcfFIV99-0I2oc4laV06Zy-Lgl6qag6nGuDT_7AgVrK92d0MLcnVylA2HKIb2-a3ecLSy0f-3%26wd%3D%26eqid%3Dd752eab40010b6a3000000055706fd1f&lcr=http%3A%2F%2Fwww.baidu.com%2Flink%3Furl%3DBecgRE7R_MjQ5CW8DUctmb6_uRh4Lsx_abNcfFIV99-0I2oc4laV06Zy-Lgl6qag6nGuDT_7AgVrK92d0MLcnVylA2HKIb2-a3ecLSy0f-3%26wd%3D%26eqid%3Dd752eab40010b6a3000000055706fd1f&ecd=0&psr=1440x900&par=1440x818&pis=-1x-1&ccd=32&cja=true&cmi=0&col=zh-CN&cdo=-1&tcn=1460075813&qn=63308d3b65b2cc65&dpv=f4c7e7c5c130edd7&tt=1460075812235.978.1128.1135" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" style="margin: 0px; border: 0px currentColor; vertical-align: bottom;" allowtransparency="">