与子目录到其他域与子目录转发域与子、目录

2023-09-02 00:37:14 作者:这支烟灭了以后

我有谁爱域和热爱更是转发域的客户端。许多这些域不具有与它们相关联的网站。他们只是用于营销和转发。我知道如何轻松域名转发到另一个,但我很好奇的是如何提出具体的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]