简体   繁体   中英

Apache : mod_rewrite : Redirect URL from abc.com to abc.com/xyz without changing the URL in browser

I have tried different things like below but no luck:

  1. Redirect "/" "REPLACE WITH YOUR COMPLETE URL" in virtual host.
  2. Redirect permanent "/one" "Replace with your complete URL" in virtual host.
  3. Outside Virtual Host:
     <Location "/"> Redirect permanent "REPLACE WITH YOUR COMPLETE URL" </Location>

But in all the cases, URL in the browser changes to the replaced URL, which we don't want.

Actual values: / to be redirected to /olyweb

How would I use URL Masking or something which can redirect internally but don't reflect on browser.

The browser will always display the URL it is talking to. It cannot be fooled.

You can only do what you want by letting your Apache httpd act as a reverse proxy . You cannot do it with things like mod_rewrite .

In a reverse proxy the httpd will sit in front of your target web server. All communication to and from your target web server will travel through the httpd. Therefore you can effectively access your target web server via an alternative URL. Unlike with HTTP Redirect solutions your browser will in the reverse proxy scenario never actually know that all content comes from the target web server. Your browser never communicates with the target web server, it communicates with your httpd process.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM