0

I have requirement where user will type url like http://example.com/Welcome in browser, but I need to send it to http://myip.com/someapp/next.html, so I wrote virtual host in httpd.conf file:

<VirtualHost *:80>
     ProxyRequests off
     ProxyPreserveHost On
     RewriteEngine On

     RewriteRule "^/(.*)" "http://myip.com/someapp/next.html" [P]
     ProxyPassReverse "/" "http://myip.com/someapp/next.html"

</VirtualHost>

This is working partly. When user enter url http://example.com/Welcomeit is being replaced with http://example.com. How can I keep complete url (http://example.com/Welcome)? would appreciate any help.

EDIT: Here is the access_log surrounding the call

184.180.123.46 - - [06/Dec/2017:21:10:41 +0000] "GET /myip.com/images/logo.png HTTP/1.1" 200 6697 "http://example.com/Welcome" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36"
184.180.123.46 - - [06/Dec/2017:21:10:51 +0000] "POST /myip/somepage HTTP/1.1" 200 7 "http://example.com/Welcome" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36"
184.180.123.46 - - [06/Dec/2017:21:10:52 +0000] "GET / HTTP/1.1" 200 3391 "http://example.com/Welcome" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36"
184.180.123.46 - - [06/Dec/2017:21:11:01 +0000] "GET / HTTP/1.1" 200 3391 "http://example.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36"
3
  • "being replaced with" - Presumably you are seeing a 3xx redirect? Or not? There would seem to be something else doing that.
    – MrWhite
    Dec 7, 2017 at 0:27
  • @MrWhite no, I am not seeing any 302 in access_log, all I see 200.
    – kosa
    Dec 7, 2017 at 3:50
  • The access log you have posted doesn't include the request for /Welcome? Also, the request for / shows /Welcome as a Referer, so that could suggest a meta or JavaScript "redirect" in the web application itself.
    – MrWhite
    Dec 11, 2017 at 10:51

0

You must log in to answer this question.

Browse other questions tagged .