Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想为我的一个域创建一个重定向到另一个域。我遵循了这个问题中报告的内容,它工作得很好。
我现在遇到的问题是我想将 www.example.com/some-page 重定向到 www.new-example.com/some-page。
现在,www.example.com/some-page 只是重定向到 www.new-example.com,这可能会让为网站某些部分创建书签的用户感到困惑。
两个 URL 都链接到同一个虚拟主机,我正在运行一个 litespeed 服务器。
将以下内容添加到您的 .htaccess 文件中:
RewriteCond %{HTTP_HOST} !^yourdomain.com [NC] RewriteRule ^ http://yourdomain.com%{REQUEST_URI} [L,R=301]
编辑:yourdomain.com 应该是您要重定向到的域。