Subdomain keeps redirect to an old subdomain

Kindly advice on what i’m missing. I want indico.wacren.net to be the main subdomain. When i edit the files in favour of indico.wacren.net I get an error; Below is my indico.conf file

eric@vm47:~$ sudo cat /etc/apache2/sites-available/indico.conf 
<VirtualHost *:443>
    ServerName events.wacren.net
    DocumentRoot "/var/empty/apache"
    Protocols h2 http/1.1

    SSLEngine             on
    SSLCertificateFile    /etc/ssl/certs/fullchain.pem
    SSLCertificateKeyFile /etc/ssl/private/privkey.pem

    SSLProtocol           all -SSLv3 -TLSv1 -TLSv1.1
    SSLCipherSuite        ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384
    SSLHonorCipherOrder   off
    SSLSessionTickets     off

    XSendFile on
    XSendFilePath /opt/indico
    CustomLog /opt/indico/log/apache/access.log combined
    ErrorLog /opt/indico/log/apache/error.log
    LogLevel error
    ServerSignature Off

    <If "%{HTTP_HOST} != 'events.wacren.net'">
        Redirect 301 / https://events.wacren.net/
    </If>

    AliasMatch "^/(images|fonts)(.*)/(.+?)(__v[0-9a-f]+)?\.([^.]+)$" "/opt/indico/web/static/$1$2/$3.$5"
    AliasMatch "^/(css|dist|images|fonts)/(.*)$" "/opt/indico/web/static/$1/$2"
    Alias /robots.txt /opt/indico/web/static/robots.txt

    SetEnv UWSGI_SCHEME https
    ProxyPass / uwsgi://127.0.0.1:8008/

    <Directory /opt/indico>
        AllowOverride None
        Require all granted
    </Directory>
</VirtualHost>




<VirtualHost *:80>
    ServerName events.wacren.net
    RewriteEngine On
    RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]
</VirtualHost>

What do you mean with “main subdomain”? And “I get an error” without details on the error isn’t helpful :wink:

Anyway, this question seems more suitable for a place related to Apache since configuring redirects in your web server isn’t really related to Indico itself.

I would simply add another VirtualHost for the redirect instead of trying to add it to the existing ones.

Noted with thanks…

In the same file? With the subdomain I want it pointed to in place?

Up to you. Apache is pretty flexible in how your structure your config files. But same file is the easiest option.

Kindly assist me please; Currently indico.wacren.net is redirecting to events.wacren.net. I tried removing the seemingly redirect lines but also get an error on the main website.

<VirtualHost *:443>
    ServerName events.wacren.net
    DocumentRoot "/var/empty/apache"
    Protocols h2 http/1.1

    SSLEngine             on
    SSLCertificateFile    /etc/ssl/certs/fullchain.pem
    SSLCertificateKeyFile /etc/ssl/private/privkey.pem

    SSLProtocol           all -SSLv3 -TLSv1 -TLSv1.1
    SSLCipherSuite        ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384
    SSLHonorCipherOrder   off
    SSLSessionTickets     off

    XSendFile on
    XSendFilePath /opt/indico
    CustomLog /opt/indico/log/apache/access.log combined
    ErrorLog /opt/indico/log/apache/error.log
    LogLevel error
    ServerSignature Off

    <If "%{HTTP_HOST} != 'events.wacren.net'">
        Redirect 301 / https://events.wacren.net/
    </If>


    AliasMatch "^/(images|fonts)(.*)/(.+?)(__v[0-9a-f]+)?\.([^.]+)$" "/opt/indico/web/static/$1$2/$3.$5"
    AliasMatch "^/(css|dist|images|fonts)/(.*)$" "/opt/indico/web/static/$1/$2"
    Alias /robots.txt /opt/indico/web/static/robots.txt

    SetEnv UWSGI_SCHEME https
    ProxyPass / uwsgi://127.0.0.1:8008/

    <Directory /opt/indico>
        AllowOverride None
        Require all granted
    </Directory>
</VirtualHost>




                                                                                   
<VirtualHost *:443>
    ServerName indico.wacren.net
    DocumentRoot "/var/empty/apache"
    Protocols h2 http/1.1

    SSLEngine             on
    SSLCertificateFile    /etc/ssl/certs/fullchain.pem
    SSLCertificateKeyFile /etc/ssl/private/privkey.pem

    SSLProtocol           all -SSLv3 -TLSv1 -TLSv1.1
    SSLCipherSuite        ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AE>
    SSLHonorCipherOrder   off
    SSLSessionTickets     off

    XSendFile on
    XSendFilePath /opt/indico
    CustomLog /opt/indico/log/apache/access.log combined
    ErrorLog /opt/indico/log/apache/error.log
    LogLevel error
    ServerSignature Off

    <If "%{HTTP_HOST} == 'events.wacren.net'">
        Redirect 301 / https://indico.wacren.net/
    </If>


    AliasMatch "^/(images|fonts)(.*)/(.+?)(__v[0-9a-f]+)?\.([^.]+)$" "/opt/indico/web/static/$1$2/$3.$5"
    AliasMatch "^/(css|dist|images|fonts)/(.*)$" "/opt/indico/web/static/$1/$2"
    Alias /robots.txt /opt/indico/web/static/robots.txt

    SetEnv UWSGI_SCHEME https
    ProxyPass / uwsgi://127.0.0.1:8008/

    <Directory /opt/indico>
        AllowOverride None
        Require all granted
    </Directory>
</VirtualHost>

That error happens because the indico.conf BASE_URL must match the URL actually used to access Indico.

And FYI, 301 redirects are cached by clients. When you had a difference redirect in place before, make sure to delete your browser’s cache to avoid any issues with a previously cached redirect.

Now i’m getting’

" Invalid URL

This Indico instance can only be accessed via https://events.wacren.net"
After changing the base url to indico.wacren.net

That sounds like you haven’t restarted indico-uwsgi.service

That worked. Really appreciate the assistance.