Redirect folder to subdomain and another server

时间:2021-04-26 11:22:47

I have following situation:

我有以下情况:

www.domain.com/folder

and I want to redirect this folder to

我想将此文件夹重定向到

www.subdomain.domain.com 

And this subdomain is redirected via DNS to another IP/Server.

此子域通过DNS重定向到另一个IP /服务器。

Is this possible, and how if so?

这可能吗,如果是这样的话?

1 个解决方案

#1


1  

Put this code in your DOCUMENT_ROOT/.htaccess file:

将此代码放在DOCUMENT_ROOT / .htaccess文件中:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC]
RewriteRule ^(folder(?:/.*|$))$ http://www.subdomain.domain.com/? [L,R]

#1


1  

Put this code in your DOCUMENT_ROOT/.htaccess file:

将此代码放在DOCUMENT_ROOT / .htaccess文件中:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC]
RewriteRule ^(folder(?:/.*|$))$ http://www.subdomain.domain.com/? [L,R]