Redirect to new domain and preserve username
- by David Brown
I recently switched to a new domain for a version control server I run. The server is usually accessed with a username included in the url such as https://[email protected]/some/stuff. I want to redirect requests to the old domain to the new domain and preserve everything else in the url (including the username). So the former url would be redirected to https://[email protected]/some/stuff. Currently I have the following rewrite condition and rule:
RewriteCond %{HTTP_HOST} sub\.olddomain\.com
RewriteRule (.*) https://sub.newdomain.net$1 [R=301,L]
This works except it drops the userinfo part of the URL. Is there a way I can preserve the user info?