简体   繁体   English

.htaccess 将一个域重定向到另一个域

[英].htaccess redirect one domain to other

I have wordpress multisite with 2 sites: https://www.example1.com/ AND https://www.example2.com/我有 2 个站点的 wordpress 多站点: https : //www.example1.com/https://www.example2.com/

example2 site is a copy of example1, but 2 is new so I want to redirect all subsites to new domain. example2 站点是 example1 的副本,但 2 是新的,所以我想将所有子站点重定向到新域。 Example: https://www.example1.com /data/post1243545 to https://www.example2.com /data/post1243545示例: https ://www.example1.com /data/post1243545 到https://www.example2.com /data/post1243545

Everything stays the same except domain除了域外,一切都保持不变

To answer the question as asked回答问题

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{HTTP_HOST} ^olddomain.com$ [OR]
  RewriteCond %{HTTP_HOST} ^www.olddomain.com$
  RewriteRule (.*)$ http://www.newdomain.com/$1 [R=301,L]
</IfModule>

per https://wpscholar.com/blog/redirect-old-domain-to-new-domain-via-htaccess/每个https://wpscholar.com/blog/redirect-old-domain-to-new-domain-via-htaccess/

However, you could simply configure the sites to use different domains and avoid having to use htaccess entirely as described in the following link.但是,您可以简单地将站点配置为使用不同的域,而不必完全按照以下链接中的说明使用 htaccess。

https://wordpress.org/support/topic/change-domain-in-multisite/ https://wordpress.org/support/topic/change-domain-in-multisite/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 .htaccess 从一个域重定向到另一个域 - Using .htaccess to redirect from one domain to another .htaccess多个域重定向到一个wordpress网站 - .htaccess multiple domain redirect to one wordpress site 如何修改.htaccess文件以仅重定向一个域的URL,而不重写同一服务器托管的其他域 - How do I modify my .htaccess file to redirect a URL for one domain only, and not rewrite other domains hosted by the same server 子域重定向(htaccess) - Sub domain redirect (htaccess) .htaccess不要仅保留一个域的路径进行重定向 - .htaccess Don't redirect with keeping path just for one domain htaccess将域名重定向到wordpress页面? - htaccess redirect domain to wordpress page? htaccess 将一个域上的所有子文件夹/页面重定向到新域 (WordPress) 上的匹配子文件夹 - htaccess redirect all subfolders/pages on one domain to matching subfolder on new domain (WordPress) 如何使用.htaccess进行此工作-将主域重定向到子域并将所有其他页面重定向到新域 - How do I make this work using .htaccess - redirect main domain to subdomain & redirect all other pages to new domain 使用域目录中的.htaccess将子域重定向到域 - Redirect subdomain to domain with .htaccess in domain directory 使用 .htaccess 或其他方式将隐藏的域名重定向到其他 DN 的子文件夹 - Hidden redirect domain name to a subfolder of an other DN using .htaccess or anything else
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM