URL rewrite for other domain names pointing to virtual server

Hello!

I’ve got a Debian Wheezy virtual host with one public static IP and installed virtualmin GPL.

I successfully set up two virtual sites:
domA.com
domB.com

On Webmin > Servers > Apache Webserver > Existing virtual hosts > Virtual Server domB.com Port 80 > Edit Directives
I added the following lines:
ServerAlias domBX.com
ServerAlias domBY.com

Now when I enter domBX.com or domBY.com, the content of domB.com is successfully shown.

What is the best method to create an URL rewrite so that instead of domBX.com only domB.com is shown in the URL bar?

Is there a way to configure all those aliases, redirects and rewrite rules at one central place / menu / config file?

Thank you very much!

L.

Okay, I made everything functional by changing .htaccess.

However, I have to edit two files for each domain change:
/etc/apache2/sites-available/domB.com.conf
and
.htaccess

Is there any easier way, e. g. through a webmin config page?

Thank you!

L.

You could also just add an alias to Virtualmin, rather than manually changing the Apache config. You can do that in Create Virtual Server, and click the “Alias of …” link.

Prior to doing that, if you want aliases to redirect to the parent, what you can do is go into System Settings -> Server Templates -> Default -> Apache Website, and on that screen, set “Create alias websites by” to “Create permanent Redirect virtual host”.

It defaults to just adding a ServerAlias option to the Apache config, which doesn’t redirect.

-Eric