apache mod_rewrite 無法解析 OK

apache mod_rewrite 無法解析 OK

我有一個 Apache 伺服器(80 連接埠)作為本地網路伺服器(82 連接埠)的反向代理運作正常,並且 mod_rewrite 沒有任何 .htaccess 檔案。

我可以導航到“確定”http://localhost/CONTACT.PRO,它顯示了位於本地網路伺服器上的網站http://localhost:82/cgi-vel/web/CONTACT.PRO

問題是嘗試使用 mod_rewrite 創建友好的 URL,它向我顯示來自本地網路伺服器的錯誤(不是 apache 錯誤),所以我想我沒有將正確的 URL 發送到本地網路伺服器(82 連接埠)

你能幫我弄清楚會發生什麼嗎?

在 Apache 資料夾中,我只有 main/original httpd.conf 啟用“LoadModule rewrite_module module/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 處理程序

相關內容