2016-04-07 59 views
-1

在同一台服务器中,我想重定向具有相同文件夹的不同域。例如。 http://test.com/thx/http://def.com/thx/htaccess使用同一文件夹重定向不同的域

无论我在“test.com/thx/”下加载的子页面将被重定向到“def.com/thx/”。

+0

尝试REGEX http://superuser.com/questions/155139/htaccess-301-redirect-with-regular-expressions –

+1

你能告诉我们你的代码吗? – starkeen

+0

我解决了它。 RewriteEngine on RewriteCond%{HTTP_HOST}^test.com [NC] RewriteRule ^(。*)$ http://def.com/thx/$1 [R = 301,NC]现在可以使用了。 – Virgil

回答

1

这是从一个URL重定向到另一个网址

#Redirect old file path to new file path 
Redirect /olddirectory/oldfile.html http://example.com/newdirectory/newfile.html 
+0

只能更改域名?我想保持文件夹/ thx /相同,只需将test.com更改为def.com。此外,文件夹/ thx /下的所有文件都可以自动更改域。 – Virgil

0

让我知道它是否适合你的方式。 Check this out

+0

我只是使用.htaccess来解决问题。不管怎样,谢谢你。 – Virgil

相关问题