Redirect Server Alias

innovot

Well-Known Member
#1
Hello:

on our Apache installation we have been using:

Code:
    RewriteEngine On
    RewriteCond %{HTTP_HOST}  !^www.somesite.com [nocase]
    RewriteRule ^(.*)$        http://www.somesite.com$1 [last,redirect=301]
so that any ServerAlias would be redirected to the primary site. Under LiteSpeed this does not appear to be working and not sure how to fix it.

Any help would be appreciated please.
 
Last edited by a moderator:

NiteWave

Administrator
#2
Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.somesite.com [nocase]
RewriteRule ^(.*)$ http://www.somesite.com$1 [last,redirect=301]
can you try following
Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.somesite.com$ [NC]
RewriteRule ^(.*)$ http://www.somesite.com/$1 [L,R=301]
it should work.
 
Last edited by a moderator:
#4
What I want to do: run a self-hosted nextcloud sever.

So I set up a ubuntu server and installed apache2 on it. After that I wanted to check that the apache2 can be reached from the local network as well as from the internet. So I configured my FritzBox that the Ports 80 and 443 get portforwarrded to the server and I also use the MyFritz DNS Service. Also checked firewall settings and all looked good so far. I tried the same setup before on a RaspberryPi with Raspberry Pi OS and it worked perfectly fine.

Now the Problem is that when trying to connect to the apache2 webserver with the domain I get the Error Message "Connection to the server failed". Connection to the webserver via IPv4 or IPv6 works perfectly fine omegle (from local network as well as from the internet) and the Apache Default Page gets displayed.
 
Top