简体   繁体   English

如何正确屏蔽/重定向Apache HTTPD中的URL?

[英]How to properly mask/redirect urls in apache httpd?

I have one apache httpd server running on a hostname: 我有一个在主机名上运行的apache httpd服务器:

firsthostname firsthostname

I have another apache httpd server running on another hostname: 我在另一个主机名上运行另一个apache httpd服务器:

secondhostname 第二主机名

I want to make it such that whenever someone goes to: 我想做到这样,只要有人去:

firsthostname, it redirects to secondhostname. firsthostname,它将重定向到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 如果用户转到firsthostname / something,尽管“ secondhostname”被屏蔽,但用户实际看到的是用户转到“ secondhostname / something”。

What and how do I configure this on the httpd installed on "firsthostname"? 什么以及如何在“ firsthostname”上安装的httpd上配置它? I am running on a windows machine. 我正在Windows机器上运行。

You can do this using apache rewrite or apache redirect 您可以使用apache重写或apache重定向来执行此操作

RewriteEngine  on
RewriteRule    ^/foo  /bar

Or 要么

Redirect /foo.html /bar.html

Check out this documentation 查看此文档

You will need a DNS server. 您将需要一个DNS服务器。 You can then simply setup a CNAME record to map firsthostname to secondhostname . 然后,您可以简单地设置CNAME记录以将firsthostname映射到secondhostname

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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