与子目录到其他域与子目录转发域 [英] Forward domain with sub directories to other domains with subdirectories

查看:244
本文介绍了与子目录到其他域与子目录转发域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有谁爱域和热爱更是转发域的客户端。许多这些域不具有与它们相关联的网站。他们只是用于营销和转发。我知道如何轻松域名转发到另一个,但我很好奇的是如何提出具体的URL,这些领域的其他特定的URL。

I have a client who loves domains and loves even more to forward domains. Many of these domains to not have websites associated with them. They are just used for marketing and forwarding. I know how to easily forward a domain to another, but what I am curious about is how to forward specific url's of these domains to other specific url's.

例如:

www.site1.com/directory - > www.site2.com/example

www.site1.com/directory --> www.site2.com/example

和然后在相同时间:

www.site1.com - > www.site3.com/example

www.site1.com --> www.site3.com/example

是拥有这个工作是通过使用.htaccess中的唯一途径?任何其他的方法?在这一点上这些域甚至没有与它们相关联,因为它们直接转发使用1and1.com的控制面板.htaccess文件。

Is the only way to have this done be through using .htaccess? Any other method? At this point these domains do not have .htaccess files even associated with them as they are directly forwarding using the control panel of 1and1.com.

如果的.htaccess是唯一的出路,就是有一个简单的方法来构建这些文件?

And if .htaccess is the only way to go, is there a simpler way to construct these files?

推荐答案

对于上面,你可以在你的.htaccess规则:

For above you can have these rules in your .htaccess:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^(www\.)?site1\.com$ [NC]
RewriteRule ^$ http://www.site3.com/example [L,R=301]

RewriteCond %{HTTP_HOST} ^(www\.)?site1\.com$ [NC]
RewriteRule ^directory(/.*)?$ http://www.site2.com/example$1 [NC,L,R=301]

这篇关于与子目录到其他域与子目录转发域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆