0

I have an Apache server (80 port) running ok as a Reverse proxy of local webserver (82 port) and mod_rewrite without any .htaccess files.

I can navigate OK to http://localhost/CONTACT.PRO, it shows me website located on local web server at http://localhost:82/cgi-vel/web/CONTACT.PRO

The problem is trying to create friendly URLs using mod_rewrite, it shows me an error from local webserver (not apache error), so I guess I am not sending the correct URL to local webserver (82 port)

Can you please help me to figure out what happens?

In Apache folder, I only have main / original httpd.conf with enable "LoadModule rewrite_module modules/mod_rewrite.so" and including "conf/extra/ABC.conf" where I put my config:

NameVirtualHost *
ExtendedStatus On

<virtualHost *>

ServerName www.ABC.com
ServerAlias 192.168.1.250
ServerAlias localhost
ServerAdmin webmaster@ABC.com
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>  

Thank you very much

1

As far as I can tell, ProxyPass is evaluated before RewriteEngine, so RewriteEngine never sees your URL. Have a look at https://stackoverflow.com/questions/9003358/apache-rewrite-then-proxy-pass

You have to tell RewriteEngine to pass the URL back to the URL handler by adding [PT]

  • thank you but is not working [L,PT] or [PT] :-( – Raul Taboraz Feb 19 '18 at 18:53
  • Just a wild guess: have you tried putting your rewrite-rules above the proxypass rules? – Andreas Rogge Feb 19 '18 at 20:41
  • it is not working :-( – Raul Taboraz Feb 20 '18 at 15:17
  • Last resort: keep the proxypassreverse rules and replace the proxypass rules with RewriteRules that do the proxying (i.e. RewriteRule ^/?(.*)$ localhost:82/cgi-vel/web/$1 [P]) – Andreas Rogge Feb 20 '18 at 16:07
  • thank you very much for taking care and trying to help! I am getting this Request-URI Too Large The requested URL's length exceeds the capacity limit for this server. – Raul Taboraz Feb 20 '18 at 21:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.