我将客户端的CMS从一个域转移到另一个域。我还更改了CMS的安装目录。旧域中的CMS安装在客户端的子目录中,而新域中的CMS安装在wwwroot中。我不想让客户难以进行此迁移,因此我想到使用.htaccess
文件插入到旧域的根目录中,以重定向到新域。特别是,我希望(例如)当客户指向旧域名时,如果再次点击CMS通过电子邮件发送给他的链接,他将被重定向到新域名的同一页面。例如,如果客户的电子邮件中有一个链接,如
https://olddomain.example/clients/viewinvoice.php?id=447
将被重定向到
https://newdomain.example/viewinvoice.php?id=447
这是怎么做到的呢?我试过:
RewriteEngine On
RewriteBase /
RewriteRule ^clients(.*)$ https://www.newdomain.example/$1 [L,R=301]
2条答案
按热度按时间ma8fv8wu1#
uelo1irk2#
如@example-person所示解决