I'm trying to redirect requests to my old git server (with my old username) to the new server (with my new username).
I'm trying to set up the following conditions:
If url is of the form http(s)://git.glmdev.tech/glmdev/any/url/here, redirect it to https://git.garrettmills.dev/garrettmills/any/url/here.
If url is http(s)://git.glmdev.tech/glmdev, redirect to https://git.glmdev.tech/garrettmills
Otherwise, redirect any http(s)://git.glmdev.tech/any/other/url to https://git.garrettmills.dev/any/other/url
I'm trying to use Apache2's RedirectMatch to do this using capture groups. I have the following virtual host configuration:
<VirtualHost *:80>
ServerName git.glmdev.tech
RedirectMatch 301 /glmdev/(.*) https://git.garrettmills.dev/garrettmills/$1
Redirect /glmdev/ https://git.garrettmills.dev/garrettmills/
Redirect / https://git.garrettmills.dev/
</VirtualHost>
<VirtualHost *:443>
ServerName git.glmdev.tech
SSLEngine on
SSLCertificateFile /etc/glmdev/ssl/_star/cert.crt
SSLCertificateKeyFile /etc/glmdev/ssl/_star/cert.key
SSLCertificateChainFile /etc/glmdev/ssl/_star/ca.crt
RedirectMatch 301 /glmdev/(.*) https://git.garrettmills.dev/garrettmills/$1
Redirect /glmdev/ https://git.garrettmills.dev/garrettmills/
Redirect / https://git.garrettmills.dev/
</VirtualHost>
Conditions 2 and 3 work as expected, however navigating to some http(s)://git.glmdev.tech/glmdev/repositoryname redirects to https://git.garrettmills.dev/garrettmills
Not sure why the capture group isn't being found or appended to the URL. Any help is appreciated. Thanks in advance.