最后,我完成了 SSL 证书的安装,并完成了从我的旧网站到我的新网站的重定向配置,但是现在,当我尝试从旧网站进入时,它会将我发送到新网站,但没有“/”,如下所示:
https://newsite.comindex.php?blabla
这是我的 httpd.conf 配置:
<VirtualHost oldsite.com:80>
ServerName oldsite.com
Redirect permanent "/" https://newsite.com/
</VirtualHost>
<VirtualHost oldsite:443>
ServerName oldsite.com
Redirect permanent "/" https://newsite.com/
</VirtualHost>
<VirtualHost *:80>
ServerName https://newsite.com
Redirect permanent "/" https://newsite.com/
</VirtualHost>
我非常感谢您提供的任何帮助。
答案1
尝试一下:
<VirtualHost *:80>
ServerName oldsite.com
Redirect permanent / https://newsite.com/
</VirtualHost>
<VirtualHost *:443>
ServerName oldsite.com
Redirect permanent / https://newsite.com/
SSLEngine On
SSLCertificateFile oldcert…
SSLCertificateKeyFile oldkey…
</VirtualHost>
<VirtualHost *:443>
ServerName https://newsite.com
Redirect permanent / https://newsite.com/
SSLEngine On
SSLCertificateFile newcert…
SSLCertificateKeyFile newkey…
<Directory /var/www/html/mysite/>
</Directory>
</VirtualHost>
不应再使用 NameVirtualHosts。请注意 Directory 指令末尾必须有斜杠。