啓用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。php
後記: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服務,看來只有這一條路了。web