apache mod_rewrite 无法解析 OK

apache mod_rewrite 无法解析 OK

我有一个 Apache 服务器(80 端口),作为本地 Web 服务器(82 端口)和 mod_rewrite 的反向代理运行,没有任何 .htaccess 文件。

我可以导航至http://localhost/CONTACT.PRO,它显示位于本地网络服务器上的网站http://本地主机:82/cgi-vel/web/CONTACT.PRO

问题是尝试使用 mod_rewrite 创建友好 URL,它向我显示了来自本地 Web 服务器的错误(不是 apache 错误),所以我想我没有向本地 Web 服务器(82 端口)发送正确的 URL

你能帮我弄清楚发生了什么事吗?

在 Apache 文件夹中,我只有主/原始 httpd.conf,启用了“LoadModule rewrite_module modules/mod_rewrite.so”并包括“conf/extra/ABC.conf”,我将配置放在其中:

NameVirtualHost *
ExtendedStatus On

<virtualHost *>

ServerName www.ABC.com
ServerAlias 192.168.1.250
ServerAlias localhost
ServerAdmin [email protected]
DirectoryIndex index.htm
ProxyPass /cgi-vel/web/  http://localhost:82/cgi-vel/web/ 
keepalive=on  
ProxyPass /  http://localhost:82/cgi-vel/web/ keepalive=on  
ProxyPassReverse /  http://localhost:82/cgi-vel/web/ keepalive=on 
ProxyPreserveHost On
ErrorLog "logs/test_web_error.log"
CustomLog "logs/test_web-access.log" combined 

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^contact$ /CONTACTAR.PRO?W-IDIOMA=EN [P]
RewriteRule ^item$   /ITEM.PRO
RewriteRule ^special /SALE.PRO?_sale=109

</virtualHost>  

非常感谢

答案1

据我所知,ProxyPass 在 RewriteEngine 之前进行评估,因此 RewriteEngine 永远不会看到你的 URL。请查看https://stackoverflow.com/questions/9003358/apache-rewrite-then-proxy-pass

您必须通过添加 [PT] 来告诉 RewriteEngine 将 URL 传回 URL 处理程序

相关内容