[英]How do i redirect one subfolder in one domain to another subfolder in another domain preserving path
[英]How to redirect one domain to another
我有两个域:
www.example1.com/ --> IP=1.2.3.4
www.example2.com/ --> IP=1.2.3.4 (same IP for both domains)
我希望所有访问www.example2.com/*
的请求都可以访问请求的页面。 我希望所有访问www.example1.com/*
请求都重定向到www.example2.com/*
。 我将如何在Apache中执行此操作? 到目前为止,我目前正在使用javascript执行此操作。
将此代码放在您的DOCUMENT_ROOT/.htaccess
文件中:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?example1\.com [NC]
RewriteRule ^ http://www.example2.com%{REQUEST_URI} [NE,R=301,L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.