Hello,

I was following a post from a user asking about the best way to redirect
all traffic on his server from port 80 to port 443.

Someone linked the original OP to
https://httpd.apache.org/docs/2.4/rewrite/avoid.html#redirect

I decided to post my own question instead of hijacking his question.   For
my website, I've been using RewriteCond and RewriteRules, but I'm
questioning whether is now the best approach or not.

I have some subdomains that get redirected to different ports that run
services that aren't port 443.  For example, when I go to
subdomain1.mydomain.com, it redirects me to mydomain.com:2083.

In this case, could I use a redirect?   Something like:

<VirtualHost *:80>
    ServerName www.mydomain.com
    Redirect "/" "https://www.mydomain.com/";
</VirtualHost>

<VirtualHost *:80>
    ServerName subdomain1.mydomain.com
    Redirect "/" "https://subdomain1.mydomain.com:2083/";
    ...
</VirtualHost>


Then, if I go to something like
http://subdomain1.mydomain.com/test/example.html, would it take me to
https://subdomain1.mydomain.com:2083/test/example.html?

That seems a lot nicer than using all those dang rewrite rules.

Thanks!

Reply via email to