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了。
本文介绍如何通过Apache的httpd.conf配置文件启用mod_rewrite模块,并设置规则实现URL重定向与重写,包括将根目录请求重定向到特定页面的方法。
995

被折叠的 条评论
为什么被折叠?



