如何设置Apache把访问该地址的请求转到另外一个站点?

如:我希望在我的机器(装了Apache)上输入http://localhost,显示的是CSDN的主页,谢谢。
---------------------------------------------------------------

---------------------------------------------------------------

============================
修改httpd.conf
LoadModule rewrite_module modules/mod_rewrite.so
RewriteEngine On
RewriteRule ^/(.*) http://www.csdn.net/ [R,L]
#无论http://localhost/XXX中XXX有多长都转到CSDN.

RewriteRule ^/$ http://www.csdn.net/ [R,L]
#只有当输入http://localhost时跳转,输入http://localhsot/index.html时不跳转.

RewriteRule ^/(.*) http://www.csdn.net/$1 [R,L]
#当输入http://localhost/mm/index.htm 时转到http://www.csdn.net/mm/index.htm

Published At
Categories with Web编程
Tagged with
comments powered by Disqus