我是mod_rewrite的新手,但我已经成功设置了Apache 2.4反向代理(不使用<directory>
)。但是,现在我需要将两个文字路径(app1和app2重定向到app1 /和app2 /):
https://external.com/app1 to https://internal.com/app1/ (with the slash)
https://external.com/app2 to https://internal.com/app2/ (with the slash)
其中app1 /和app2 /是
ProxyPass "/app1/" "https://internal.com/app1/"
ProxyPassReverse "/app1/" "https://internal.com/app1/"
ProxyPass "/app2/" "https://internal.com/app2/"
ProxyPassReverse "/app2/" "https://internal.com/app2/"
我已尝试过对这些内容的修改,但它们会导致循环或无法正常工作。
RewriteEngine On
RewriteRule ^/(app1)$ $1/ [PT]
RewriteRule ^/(app2)$ $1/ [PT]
思考?再说一次,我不太了解mod_rewrite。
答案 0 :(得分:0)
我使用mod_rewrite
代替Redirect /app1 /app1/
Redirect /app2 /app2/
:
{{1}}