所以我遇到以下问题:当我使用https://www.example.com作为域时,我得到内容,但是当我使用https://example.com时,我得到通用 TYPO3 404 错误页面。
我尝试设置一个重定向,其中 example.com 和 .* 作为源路径,我的起始页作为目标,我还尝试在站点配置中设置 baseVariants。有点奇怪的是,我的正常基地只是 example.com 而不是www.example.com但www.example.com是正在工作的,而另一个只是给出 404。
我需要可靠地将https://example.com和https://example.com配置为获得相同的页面。
我在带有 Apache Web 服务器和 PHP 8.1 的 Ubuntu 22.04.4 上使用 TYPO v12.4.14
[这是我尝试使用重定向的方法。但这不起作用,因为正则表达式没有分隔符。至少这是我最初发表这篇文章以来学到的] 1
编辑2:我尝试制作2个虚拟主机将 example.com 重定向到www.example.com。这是我的配置文件:
文件1 example.conf:
<VirtualHost *:80>
ServerName example.com
ServerAdmin [email protected]
Redirect permanent / https://www.example.com
</VirtualHost>
文件 2 示例-ssl.conf
<VirtualHost *:443>
ServerName example.com
ServerAdmin [email protected]
Redirect permanent / https://www.example.com
</VirtualHost>
现在它适用于 http:// 示例。com 但不适用于 https:// 示例。com
这是我的默认配置 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>