【发布时间】:2013-11-13 02:51:56
【问题描述】:
我使用 apache HTTPD 服务器作为前端,并希望将某些 url 重定向到本地运行的另一台服务器。
比如我想要:
http://www.example.com/index.php 加载位于/var/www/index.php 的文件
http://www.example.com/products/*代理到另一个本地服务器和 url,例如http://127.0.0.1:9000/
我正在尝试在根 www 目录中编写一个简单的 .htaccess 文件,但每当我执行此简单示例时,它都会在 httpd 日志中给我一个 File does not exist 错误:
.htaccess:
RewriteEngine On
RewriteRule ^test.html$ /index.php
我试图查找此错误,但所有在线参考资料都已过时。例如,mod_rewrite error: [client 127.0.0.1] File does not exist 引用了 httpd.conf,它不再包含在 apache httpd 中。
有谁知道为什么mod_rewrite 不起作用?或者如何写一个重定向到另一个本地服务器?
【问题讨论】:
标签: apache .htaccess mod-rewrite proxy