关于apach的RewriteRule的笔记

使用方法

LoadModule rewrite_module modules/mod_rewrite.so
RewriteRule / http://www.apache.org [R=301,L]

使用反向代理时,同样可以使用RewriteRule。如果需要更灵活的反向代理设置,请参考RewriteRule指令配合[P]标志使用。

不过从安全方面考虑,应该使用ProxyPass。

Security Warning
Take care when constructing the target URL of the rule, considering the security impact from allowing the client influence over the set of URLs to which your server will act as a proxy. Ensure that the scheme and hostname part of the URL is either fixed, or does not allow the client undue influence.

以下是中文的同义句:

https://httpd.apache.org/docs/2.4/mod/mod_rewrite.html#rewriterule
https://httpd.apache.org/docs/2.4/rewrite/flags.html#flag_l

请参考上述链接中的信息。