错误重定向到 www.www2.example.de 的原因是什么

错误重定向到 www.www2.example.de 的原因是什么

我为我们的主要网站设置了一个测试服务器www.example.com
我将 apache-sites-config 设置为www2.example.com
我删除了.htaccess/ 并将其调整为保存基本的 wordpress 条目。
我禁用了浏览器的自动完成功能。

当我输入时,www2.example.com我被重定向并永久移动到www.www2.example.com

当我输入时192.168.0.1我被重定向到www.www2.example.com

有人能说出错误可能出在哪里吗?

.htaccess

# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress

sites-config for the first vHost

<VirtualHost *:80>
     Protocols h2 http/1.1
     ServerAdmin [email protected]
     DocumentRoot /var/www/html/
     ServerName www2.example.de
     ServerAlias www2.example.de

     <Directory /var/www/html>
        Options -Indexes +FollowSymLinks +MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
     </Directory>

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>


<VirtualHost *:443>
        ServerAdmin [email protected]
        Protocols h2 h2c http/1.1
        DocumentRoot /var/www/html/
        ServerName www2.example.de
        ServerAlias www2.example.de

        # added 01.04.2019 BEGINN
        <Directory /var/www/html>
                Options -Indexes +FollowSymLinks
                AllowOverride all
                Order allow,deny
                allow from all
        </Directory>
        # added 01.04.2019 END
        <Directory /var/www/html/>
          Options -Indexes +FollowSymlinks
          AllowOverride All
          Require all granted
         allow from all
        </Directory>
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
        SSLEngine off
</VirtualHost>
</IfModule>

sites-config for second vHost

<VirtualHost *:80>
     Protocols h2 http/1.1
     ServerAdmin [email protected]
     DocumentRoot /var/www/html1/example2/
     ServerName www2.example2.eu
     ServerAlias www2.example2.eu

     <Directory /var/www/html1/example2>
        Options -Indexes +FollowSymLinks +MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
     </Directory>

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

The request- and response-header for www2.example.de

Connection:     Keep-Alive
Content-Length: 236
Content-Type:   text/html; charset=iso-8859-1
Date:           Wed, 26 May 2021 10:41:46 GMT
Expires:        Wed, 26 May 2021 10:42:46 GMT
Keep-Alive:     timeout=5, max=100
Location:       https://www.www2.example.de/
Server:         Apache


Accept:         text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding:gzip, deflate
Accept-Language:de,en-US;q=0.7,en;q=0.3
Cache-Control:  no-cache
Connection:     keep-alive
DNT:            1
Host:           www2.example.de
Pragma:         no-cache
Upgrade-Insecure-Requests:  1
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0

答案1

您应该检查 WordPress 网站 URL 设置。如果网站 URL 与当前虚拟主机主机名不匹配,WordPress 会将 301 重定向发送回网站 URL。

答案2

SNI 将请求发送到 Live-Server 而不是测试服务器。并且 Live-Server 具有重写规则。

相关内容