大网数据广告活动
网站运营与故障问答

Redirect requests on alternate port for Apache virtual host

· 52CE 我爱测

I have Apache server where I make my LoadBalancer for my application sereres through proxy and balancermember. Some of my clients come from legacy access, they use a port in the URL example.com:2030 as informed by the old team. S…

问题原文

原帖链接 · Gustavo Oliveira · CC BY-SA 4.0

I have Apache server where I make my LoadBalancer for my application sereres through proxy and balancermember. Some of my clients come from legacy access, they use a port in the URL example.com:2030 as informed by the old team. So vhost is that way.

<VirtualHost *:80 *:2030>

I would like to force them to just 80 with a redirect to example.com. Is this possible?

已采纳解答

原帖链接 · MrWhite · CC BY-SA 4.0

<VirtualHost *:80 *:2030>

Separate the vHosts, so that port 2030 has its own container and implement a site-wide redirect in that container to port 80 (or HTTPS/443?). For example:

<VirtualHost *:2030>
    ServerName example.com
    ServerAlias www.example.com

    # Redirect everything to port 80
    Redirect 301 / http://example.com/
</VirtualHost>

HOWEVER, aren't you using HTTPS (port 443)? Or maybe this is handled by the front-end proxy? In which case the above should redirect to https://.....

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2021-06-22)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。