网站https://www.example.com的域名为https://www.example.be。 该网站使用SSL,访问者被重定向到安全版本。
但是,当访客输入浏览器示例时,他/她将被重定向到https://www.example.com而不是https://www.example.be。
Htaccess是:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} ^(.+)$ [NC]
RewriteRule ^(.*)$ https://www\.%1/$1 [R=301,L]
</IfModule>
如何将domain.be(以及所有子序列页面等)重定向到https://www.example.be而不是https://www.example.com?
答案 0 :(得分:0)
事实证明,向.htaccess添加以下规则可以实现:
RewriteCond %{HTTP_HOST} ^example.be [NC]
RewriteRule ^(.*)$ https://www.example.be/$1 [L,R=301]