在同一台服务器中,我想重定向具有相同文件夹的不同域。例如。 http://test.com/thx/至http://def.com/thx/。htaccess使用同一文件夹重定向不同的域
无论我在“test.com/thx/”下加载的子页面将被重定向到“def.com/thx/”。
在同一台服务器中,我想重定向具有相同文件夹的不同域。例如。 http://test.com/thx/至http://def.com/thx/。htaccess使用同一文件夹重定向不同的域
无论我在“test.com/thx/”下加载的子页面将被重定向到“def.com/thx/”。
这是从一个URL重定向到另一个网址
#Redirect old file path to new file path
Redirect /olddirectory/oldfile.html http://example.com/newdirectory/newfile.html
只能更改域名?我想保持文件夹/ thx /相同,只需将test.com更改为def.com。此外,文件夹/ thx /下的所有文件都可以自动更改域。 – Virgil
尝试REGEX http://superuser.com/questions/155139/htaccess-301-redirect-with-regular-expressions –
你能告诉我们你的代码吗? – starkeen
我解决了它。 RewriteEngine on RewriteCond%{HTTP_HOST}^test.com [NC] RewriteRule ^(。*)$ http://def.com/thx/$1 [R = 301,NC]现在可以使用了。 – Virgil