简体   繁体   中英

How to properly mask/redirect urls in apache httpd?

I have one apache httpd server running on a hostname:

firsthostname

I have another apache httpd server running on another hostname:

secondhostname

I want to make it such that whenever someone goes to:

firsthostname, it redirects to secondhostname. If the user goes to firsthostname/something, what the user actually sees is the as if the user went to "secondhostname/something", though the "secondhostname" is masked

What and how do I configure this on the httpd installed on "firsthostname"? I am running on a windows machine.

You can do this using apache rewrite or apache redirect

RewriteEngine  on
RewriteRule    ^/foo  /bar

Or

Redirect /foo.html /bar.html

Check out this documentation

You will need a DNS server. You can then simply setup a CNAME record to map firsthostname to secondhostname .

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