# Strange redirect /server alias problem returns

**URL:** <https://forum.virtualmin.com/t/strange-redirect-server-alias-problem-returns/134180>\
**Category:** Help! (Home for newbies)\
**Created:** [July 15, 2025, 12:53pm UTC](https://forum.virtualmin.com/t/strange-redirect-server-alias-problem-returns/134180 "2025-07-15T12:53:00Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![cristianbanu](https://cdn.forum.virtualmin.com/letter_avatar_proxy/v4/letter/c/5daacb/32.png) [@cristianbanu](https://forum.virtualmin.com/u/cristianbanu)\
**Post date:** [July 15, 2025, 12:53pm UTC](https://forum.virtualmin.com/t/strange-redirect-server-alias-problem-returns/134180/1 "2025-07-15T12:53:00Z")

</div>

| SYSTEM INFORMATION | |
| --- | --- |
| OS type and version | Debian 12 |
| Virtualmin version | 7.30.8 |

It was posted initially [here](https://forum.virtualmin.com/t/strange-redirect-server-alias-problem/133381), but the topic was closed and can’t reopen. I have discovered today that the issue started again. So, I have my [domain.com](http://domain.com) and [my-domain.com](http://my-domain.com). I was setting a server alias from [my-domain.com](http://my-domain.com) to my [domain.com](http://domain.com), and after some troubles it was working. Today I have discovered that has the same initial problem, that instead of pointing to my [domain.com](http://domain.com) it points to the default virtual server. I really didn’t make any modification to virtual servers after initial setup. The logs for the virtual server and alias didn’t show any intervention so not sure what actually triggered them back to initial error.

---

<div class="post-metadata">

**Author:** ![Joe](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/joe/32/9_2.png) [@Joe](https://forum.virtualmin.com/u/Joe)\
**Post date:** [July 17, 2025, 4:42am UTC](https://forum.virtualmin.com/t/strange-redirect-server-alias-problem-returns/134180/2 "2025-07-17T04:42:29Z")

</div>

This is some variation of “the wrong site shows up”, and we have a FAQ for it: [Troubleshooting Websites | Virtualmin — Open Source Web Hosting Control Panel](https://www.virtualmin.com/docs/server-components/troubleshooting-websites/#the-wrong-site-shows-up)

If I were a betting man, I’d wager your server IP changed and you’re using IP-based VirtualHost identifiers. If you can’t count on your IP to stay the same on this server, you should use `*`, instead. But, it could be a variety of other stuff.

It’s always something about the way Apache interprets your VirtualHosts is different from the way you’re interpreting them, and since Apache is the web server, you need to accommodate Apache’s weird little quirks.

---

<div class="post-metadata">

**Author:** ![cristianbanu](https://cdn.forum.virtualmin.com/letter_avatar_proxy/v4/letter/c/5daacb/32.png) [@cristianbanu](https://forum.virtualmin.com/u/cristianbanu)\
**Post date:** [July 17, 2025, 6:40am UTC](https://forum.virtualmin.com/t/strange-redirect-server-alias-problem-returns/134180/3 "2025-07-17T06:40:10Z")

</div>

Hi, thanks for the reply.

1. The server IP didn’t change, but indeed I have set up virtual hosts to use other IP then default. The machine has 4 IPs each with specific designation. Whenever I create a virtual host, I make sure I select the right IP (anyway, all virtual hosts have the same IP). It is defined in the server template, but somehow for the external IP it comes with the default IP selected not with the IP.
2. Listing virtual hosts from Apache I noticed that for the alias I got only 2 lines instead of 4 like the rest:  
 ![image](https://cdn.forum.virtualmin.com/uploads/default/original/3X/2/e/2e6eafad329611aec6930265835e0fb685ff86f3.jpeg)

The first 4 lines are for the real domanin for which I try to create alias, the next 4 are for a normal domain and the last 2 are the alias. I’m not sure if the domain aliases should have 4 lines or 2.  
Anyway, the .conf are empty for the alias.  
3) Opening the conf for the principal domain, I have noticed that for ServerAlias directive it listed also webmail and admin for the alias domain but not the www. I have added it to the list, restarted Apache but to no avail. Somehow, somewhere a step is missing.

---

<div class="post-metadata">

**Author:** ![Joe](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/joe/32/9_2.png) [@Joe](https://forum.virtualmin.com/u/Joe)\
**Post date:** [July 17, 2025, 6:57am UTC](https://forum.virtualmin.com/t/strange-redirect-server-alias-problem-returns/134180/4 "2025-07-17T06:57:00Z")

</div>

First, do not mix `*` with IP-identified VirtualHosts, even when talking about 80 vs 443. That guarantees Apache behaves in a way that makes no sense to normal human people, this is _especially_ true if your server has multiple IP addresses. Pick one, and do that. If you must use multiple IP addresses (why? all services on a modern system support SNI), you need to use IPs for all.

Fixing that will probably resolve your issue.

Also, the `webmail` and `admin` ServerAliases are unrelated to this issue. If you have questions about those, make a new topic.

---

<div class="post-metadata">

**Author:** ![cristianbanu](https://cdn.forum.virtualmin.com/letter_avatar_proxy/v4/letter/c/5daacb/32.png) [@cristianbanu](https://forum.virtualmin.com/u/cristianbanu)\
**Post date:** [July 17, 2025, 7:12am UTC](https://forum.virtualmin.com/t/strange-redirect-server-alias-problem-returns/134180/5 "2025-07-17T07:12:28Z")

</div>

I didn’t create those hosts. My assumption was Virtualmin created them as it creates non-SSl and SSL sites. For each domain I have created redirects from non-ssl to ssl, as I don’t use non-ssl.

Also, IPs are not an issue as they work as intended.

---

<div class="post-metadata">

**Author:** ![Joe](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/joe/32/9_2.png) [@Joe](https://forum.virtualmin.com/u/Joe)\
**Post date:** [July 17, 2025, 7:20am UTC](https://forum.virtualmin.com/t/strange-redirect-server-alias-problem-returns/134180/6 "2025-07-17T07:20:47Z")

</div>

So, you don’t actually want to fix the problem?

---

<div class="post-metadata">

**Author:** ![cristianbanu](https://cdn.forum.virtualmin.com/letter_avatar_proxy/v4/letter/c/5daacb/32.png) [@cristianbanu](https://forum.virtualmin.com/u/cristianbanu)\
**Post date:** [July 17, 2025, 7:35am UTC](https://forum.virtualmin.com/t/strange-redirect-server-alias-problem-returns/134180/7 "2025-07-17T07:35:31Z")

</div>

I really not understand how. As I said, those virtual hosts were created by Virtualmin, not by me. While I’m not sure while they were listed like that, opening /etc/apache2/sites-enabled/mydomain.ro.conf looks ok. The only thing that got my attention is that special subdomains/subservers like admin and webmail for alias were listed as ServerAlias of the main domain, while www and alias domain not. But placing three manually didn’t work as I supposed it would.

---

<div class="post-metadata">

**Author:** ![cristianbanu](https://cdn.forum.virtualmin.com/letter_avatar_proxy/v4/letter/c/5daacb/32.png) [@cristianbanu](https://forum.virtualmin.com/u/cristianbanu)\
**Post date:** [July 17, 2025, 7:43am UTC](https://forum.virtualmin.com/t/strange-redirect-server-alias-problem-returns/134180/8 "2025-07-17T07:43:43Z")

</div>

Also, noticed something. I have deleted the alias, but in Apache vurtualhosts list it is still present. I have deleted manually, recreated the alias, but still the same problem.

---

<div class="post-metadata">

**Author:** ![Joe](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/joe/32/9_2.png) [@Joe](https://forum.virtualmin.com/u/Joe)\
**Post date:** [July 17, 2025, 4:30pm UTC](https://forum.virtualmin.com/t/strange-redirect-server-alias-problem-returns/134180/9 "2025-07-17T16:30:54Z")

</div>

You should not mix and match IP and `* ` VirtualHosts. It doesn’t matter if Virtualmin created them, that just means Virtualmin was misconfigured for your environment.

---

<div class="post-metadata">

**Author:** ![Joe](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/joe/32/9_2.png) [@Joe](https://forum.virtualmin.com/u/Joe)\
**Post date:** [July 17, 2025, 4:32pm UTC](https://forum.virtualmin.com/t/strange-redirect-server-alias-problem-returns/134180/10 "2025-07-17T16:32:06Z")

</div>

And, as I said, if you want to talk about ServerAliases, make a new topic. It is unrelated to the issue you are having (those are automatically generated by Virtualmin to redirect to Webmin and Usermin, and, as with everything is configurable).

---

<div class="post-metadata">

**Author:** ![cristianbanu](https://cdn.forum.virtualmin.com/letter_avatar_proxy/v4/letter/c/5daacb/32.png) [@cristianbanu](https://forum.virtualmin.com/u/cristianbanu)\
**Post date:** [July 17, 2025, 7:12pm UTC](https://forum.virtualmin.com/t/strange-redirect-server-alias-problem-returns/134180/11 "2025-07-17T19:12:34Z")

</div>

The problem is that I cant’t find the \* 80 hosts. All the hosts defined in site-enabled and sites-available are defined with IP.

 ![image](https://cdn.forum.virtualmin.com/uploads/default/original/3X/1/7/178fbe90f7233f09a419deeb032737a7a3e7dc0e.png)

 ![image](https://cdn.forum.virtualmin.com/uploads/default/original/3X/5/b/5babf78e8a5935903065ed7008acf0a208cff693.png)  
The list posted above, with \* 80 was generated by the comand in the tutorial of your first reply  
grep -i ‘virtualhost’ /etc/apache2/sites-enabled/\*.conf 2\>/dev/null || grep -i ‘virtualhost’ /etc/httpd/conf/httpd.conf 2\>/dev/null  
, but as you can see, both in site-enable and sites-available, the hosts are correctly defined. The hosts conf for alias domain is empty (not sure how it is designed to be).  
Since I have defined in the new server template the correct IP address, all servers and subservers are created correct with the right IP, so should be the server alias as it uses the same template.

---

<div class="post-metadata">

**Author:** ![Joe](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/joe/32/9_2.png) [@Joe](https://forum.virtualmin.com/u/Joe)\
**Post date:** [July 17, 2025, 9:25pm UTC](https://forum.virtualmin.com/t/strange-redirect-server-alias-problem-returns/134180/12 "2025-07-17T21:25:32Z")

</div>

The file they are in is shown by the grep. `grep` didn’t invent those lines. They are in the file.

---

<div class="post-metadata">

**Author:** ![cristianbanu](https://cdn.forum.virtualmin.com/letter_avatar_proxy/v4/letter/c/5daacb/32.png) [@cristianbanu](https://forum.virtualmin.com/u/cristianbanu)\
**Post date:** [July 18, 2025, 12:11pm UTC](https://forum.virtualmin.com/t/strange-redirect-server-alias-problem-returns/134180/13 "2025-07-18T12:11:14Z")

</div>

Ok, after cleaning up the hosts, I got an 301 “Moved permanently” page instead of the redirect.

---

<div class="post-metadata">

**Author:** ![Ilia](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/ilia/32/10185_2.png) [@Ilia](https://forum.virtualmin.com/u/Ilia)\
**Post date:** [July 18, 2025, 12:37pm UTC](https://forum.virtualmin.com/t/strange-redirect-server-alias-problem-returns/134180/14 "2025-07-18T12:37:37Z")

</div>

> [@cristianbanu](#):
>
> Ok, after cleaning up the hosts, I got an 301 “Moved permanently” page instead of the redirect.

What you should do is to make sure that each block in all the domains listed in `/etc/apache2/sites-available/` has `VirtualHost` directives with **only** `*:80` or `*:443`, without any IPs.

For example:

```shell
<VirtualHost *:80>
#
</VirtualHost>
<VirtualHost *:443>
#
</VirtualHost>

```

---

<div class="post-metadata">

**Author:** ![cristianbanu](https://cdn.forum.virtualmin.com/letter_avatar_proxy/v4/letter/c/5daacb/32.png) [@cristianbanu](https://forum.virtualmin.com/u/cristianbanu)\
**Post date:** [July 18, 2025, 12:54pm UTC](https://forum.virtualmin.com/t/strange-redirect-server-alias-problem-returns/134180/15 "2025-07-18T12:54:14Z")

</div>

The hosts are “glued” to a specific IP on the machine, all of them are with IP:443. Is there a solution for this type of setup?

---

<div class="post-metadata">

**Author:** ![Ilia](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/ilia/32/10185_2.png) [@Ilia](https://forum.virtualmin.com/u/Ilia)\
**Post date:** [July 18, 2025, 1:03pm UTC](https://forum.virtualmin.com/t/strange-redirect-server-alias-problem-returns/134180/16 "2025-07-18T13:03:23Z")

</div>

> [@cristianbanu](#):
>
> The hosts are “glued” to a specific IP on the machine, all of them are with IP:443. Is there a solution for this type of setup?

Yes, if you have `*:80` and `*:443` in all `<VirtualHost>` directives, for all domains on the system, then it will work.

---

<div class="post-metadata">

**Author:** ![Joe](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/joe/32/9_2.png) [@Joe](https://forum.virtualmin.com/u/Joe)\
**Post date:** [July 18, 2025, 4:32pm UTC](https://forum.virtualmin.com/t/strange-redirect-server-alias-problem-returns/134180/17 "2025-07-18T16:32:22Z")

</div>

I assumed they wanted to be able to use specific IPs for specific VirtualHosts. Either is OK as long as they are right and not mixed (using `*` and IPs will always do something you don’t expect, because Apache selects what to serve based on unintuitive ways of interpreting the definition…it looks at IP before name, for example, and if an IP matches, it’ll choose that over `*`, AFAIK).

---

<div class="post-metadata">

**Author:** ![Ilia](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/ilia/32/10185_2.png) [@Ilia](https://forum.virtualmin.com/u/Ilia)\
**Post date:** [July 18, 2025, 4:33pm UTC](https://forum.virtualmin.com/t/strange-redirect-server-alias-problem-returns/134180/18 "2025-07-18T16:33:05Z")

</div>

Yeah, and it’s much easier to set up if there are multiple IPs.

---

<div class="post-metadata">

**Author:** ![Joe](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/joe/32/9_2.png) [@Joe](https://forum.virtualmin.com/u/Joe)\
**Post date:** [July 18, 2025, 4:34pm UTC](https://forum.virtualmin.com/t/strange-redirect-server-alias-problem-returns/134180/19 "2025-07-18T16:34:51Z")

</div>

> [@cristianbanu](#):
>
> after cleaning up the hosts, I got an 301 “Moved permanently”

That’s a different problem, I think, so we’re making progress.

A 301 would generally be coming from configuration, maybe in an `.htaccess` file in the `DocumentRoot` but maybe also something from an application running on the domain?

---

<div class="post-metadata">

**Author:** ![cristianbanu](https://cdn.forum.virtualmin.com/letter_avatar_proxy/v4/letter/c/5daacb/32.png) [@cristianbanu](https://forum.virtualmin.com/u/cristianbanu)\
**Post date:** [July 18, 2025, 5:43pm UTC](https://forum.virtualmin.com/t/strange-redirect-server-alias-problem-returns/134180/20 "2025-07-18T17:43:31Z")

</div>

Actually we are back to square 1 as again redirects to first site. It’s the same behavior like the first time, it works for a while (ok, this time only showed 301, but first time was working).  
Now all virtual hosts point to the same IP and port, each virtual host has only one entry, like this:

 ![image](https://cdn.forum.virtualmin.com/uploads/default/original/3X/9/c/9c7e0ae5e4492201004fa552dffd8e4f49afc226.png)  
Since I posted the message with 301 error I didn’t touch the server, somehow looks like it is reverting to a previous state itself (which I believe it is practically impossible).

[Next page](https://forum.virtualmin.com/t/strange-redirect-server-alias-problem-returns/134180.md?page=2)
