我有AWS EC2 Ubuntu 14.04服务器。我的实时站点托管在https://abc.example.com之类的子域中,我已经使用apache2虚拟主机创建了一个子域。虚拟主机信息如下。现在,我需要将https://abc.example.com重定向到https://live.example.com。但是已经打开https://abc.example.com的用户无法重定向到实时链接。为新用户和chrome私有窗口成功重定向。
我尝试了以下操作。
1.在虚拟主机apache2 conf中添加了重定向规则。
2.在根代码.htaccess中添加了重定向规则
3.使用重定向逻辑
1. .htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
Redirect 301 / https://playground.ryb.nl
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^(.*) /index.html [NC,L]
</IfModule>
2. Virtual Host details
<VirtualHost *:443>
ServerName pre-order.example.nl
ServerAlias www.pre-order.example.nl
DocumentRoot "/var/www/html/abc_beta_example"
redirect / https://www.example.nl/
SSLEngine on
SSLCertificateFile /var/www/html/wild-card-certificate/certificate.crt
SSLCertificateKeyFile /var/www/html/wild-card-certificate/certificate.key
SSLCertificateChainFile /var/www/html/wild-card-certificate/certificate.p7b
Header set Access-Control-Allow-Origin "*"
Header add Access-Control-Allow-Headers "origin, x-requested-with, content$
#ErrorLog "logs/domain1-error_log"
#CustomLog "logs/domain1-access_log" common
</VirtualHost>
3. I am building my application using react js following app launch code I am using to redirect.
export class App extends React.Component {
constructor(props) {
super(props);
this.state = {
loading: true,
location: null,
};
window.location = 'https://live.example.nl/';
}
}
这似乎是一个缓存问题。我只想将我的网站https://abc.example.com重定向到https://live.example.com