virtual host redirect doesnt work

Alles, was den Apache betrifft, kann hier besprochen werden.

virtual host redirect doesnt work

Postby luggie » 25. October 2017 13:57

Hi folks,
I got three websites with 302 redirects in their virtual host files.
However they don't redirect to the site I specified but to my main website.
In this case abiria.ch
I guess the problem is quite simple but I don't know where to start searching.
It looks like that if a site has no dedicated folder in /var/www/... always redirects to abiria.ch
instead of what I specified in the virtual host file.

Here is an example of one of the three virtual hosts. The others only redirect to other websites.

Code: Select all
<VirtualHost *:80>
        ServerName www.zielgruppenmanagement.de
        ServerAdmin luggie@gmx.net
        Redirect 302 / https://www.abiria.ch/fuehrungsfitness/vertriebsaktivier$
</VirtualHost>


greez luggie
luggie
 
Posts: 11
Joined: 14. August 2015 17:22
Operating System: ubuntu 14.04, apache2.4

Re: virtual host redirect doesnt work

Postby Nobbie » 25. October 2017 17:08

Probably the VirtualHosts definition does not work for any reason, therefore the Redirect is not executed. See error_log and access_log for more information. This is only an example of an error.
Nobbie
 
Posts: 9761
Joined: 09. March 2008 13:04

Re: virtual host redirect doesnt work

Postby luggie » 07. November 2017 13:20

I got a little closer to a solution.
Some of my websites are older. For them redirecting using the following code works:
Code: Select all
<VirtualHost *:80>
        ServerAdmin luggie@gmx.net
        RedirectMatch permanent ^/(.*) https://abiria.ch/$1
</VirtualHost>

For all new Websites, hosted the same way via virtual host in apache2 is simply redirects to my main page abiria.ch (like above)
no matter what I send them to...
site are enabled....
any suggestions?
luggie
 
Posts: 11
Joined: 14. August 2015 17:22
Operating System: ubuntu 14.04, apache2.4

Re: virtual host redirect doesnt work

Postby Nobbie » 07. November 2017 19:21

luggie wrote:For all new Websites, hosted the same way via virtual host in apache2 is simply redirects to my main page abiria.ch (like above)
no matter what I send them to...
site are enabled....
any suggestions?


Sorry, but I dont understand anything, what do you mean by "no matter what i send them to .. site are enabled"?? Please explain more precisely.
Nobbie
 
Posts: 9761
Joined: 09. March 2008 13:04

Re: virtual host redirect doesnt work

Postby luggie » 14. November 2017 14:41

ok, another try :D

I have some domains, hosted on a root server. Most of them should be redirected to one domain or subpages of it.
However doing it the most obvious way, by editing the virtual host files of the domains, meant to be redirected,
using 'redirect or redirectmatch with 301 or 302' isn't working.
They simply redirect to another domain that I own, which is hosted on another server (not my root server) no matter
what I write in the virtual host files.
(Mod rewrite in apache2 is set up. All Domains are enabled and running).

I now "solved" the problem by not redirecting them with virtual host file commands but in .htaccess files that I
needed to create for every domain, which is quite a detour.

I'm wondering why all domains redirect to that page, not hosted on the server but somewhere else by default.
They do so even if no virtual host files but only DNS records and the domain registration on the internal dashboard
for my root server exist for them. Like ... from where could they even know of this domain?

What I'm looking for ultimately is something like a config, that somehow overwrites individual virtual host
configs that causes this. I've been searching in apache2.conf but couldn't find.

you now know what I mean? :)
luggie
 
Posts: 11
Joined: 14. August 2015 17:22
Operating System: ubuntu 14.04, apache2.4

Re: virtual host redirect doesnt work

Postby Nobbie » 16. November 2017 00:29

Bahnhof?

Schreibe doch bitte einfach Deutsch, vielleicht verstehe ich es dann.
Nobbie
 
Posts: 9761
Joined: 09. March 2008 13:04

Re: virtual host redirect doesnt work

Postby Nobbie » 16. November 2017 11:02

Ich habe es nochmal durchgelesen, so langsam glaube ich zu verstehen, was gemeint ist. Mein Verdacht: die angelegten VirtualHosts (leider sagst Du auch überhaupt nichts dazu, was für eine Apache Installation das ist und wie/wie/was die VirtualHosts festgelegt sind) werden ignoriert bzw. existieren nicht in Apache. Stattdessen wird irgendein anderer VirtualHost genommen (Default ist immer der erste von oben) und da steht wahrscheinlich der Redirect auf den anderen Server drin. Vielleicht sind auch überhaupt keine VirtualHosts aktiv und es wird die EInstellung aus der globalen Umgebung für ServerName usw. genommen.

Sonst gäbe es keinen Grund, einen unbedingten (da ist ja keine Bedingung mit verknüpft) Redirect zu ignorieren.
Nobbie
 
Posts: 9761
Joined: 09. March 2008 13:04


Return to Apache

Who is online

Users browsing this forum: No registered users and 5 guests