1,在httpd.conf中找到LoadModule rewrite_module modules/mod_rewrite.so打开它。
2,RewriteEngine On 打开地址重写引擎
#让服务器知道我们使用的是 /xyz 而不是物理路径 /abc/def
#RewriteBase /xyz
RewriteRule ^/$ http://localhost/index.php
当你输入localhost的时候,它会跳向http://localhost/index.php
RewriteRule ^/$ /index.php
当你输入localhost的时候,它依然会是localhost但是实际内容指向的是index.php,类似forward一样。不过这时候,就没办法转发给tomcat了。