So I have the following problem: When I use https://www.example.com as the domain, I get the content but when I use https://example.com I get the generic TYPO3 404 error page.
I tried setting up a redirect with example.com and .* as the source path and my starting page as the target and I also tried setting up baseVariants in the site config. It's a bit strange that my normal base is just example.com and not www.example.com but www.example.com is the one that is working while the other one just gives a 404.
I need to reliable have https://example.com and https://example.com configured to get the same page.
I use TYPO v12.4.14 on an Ubuntu 22.04.4 with an Apache Webserver and PHP 8.1
[This is what I tried with the redirects. But that does not work because the regular expression has no delimiters. At least that is what I learned in the time since I made this post initially] 1
Edit 2: I tried to make 2 vhosts to redirect example.com to www.example.com. Here are my config files:
File 1 example.conf:
<VirtualHost *:80>
ServerName example.com
ServerAdmin [email protected]
Redirect permanent / https://www.example.com
</VirtualHost>
File 2 example-ssl.conf
<VirtualHost *:443>
ServerName example.com
ServerAdmin [email protected]
Redirect permanent / https://www.example.com
</VirtualHost>
Now it works for http:// example. com but not for https:// example. com
Note: I asked this before on stack overflow, and copyed it to here.
This is my default conf 000-default-le-ssl.config
<IfModule mod_ssl.c>
<VirtualHost *:443>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
# ServerName example.com
ServerAdmin [email protected]
DocumentRoot "/var/www/Example/public/"
<Directory "/var/www/Example/public">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
</VirtualHost>
</IfModule>
<IfModule mod_ssl.c>
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster@localhost
Redirect permanent / https://www.example.com/
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>