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?

1 Answer 1

<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/

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://.....


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.