2016-04-07 18 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

はそれがあなたのために働くなら、私に教えてください

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

ドメインのみを変更できますか?私はfolder/thx/sameのままで、test.comをdef.comに変更するだけです。また、フォルダ/ thx /下のすべてのファイルは自動的にドメインを変更できます。 – Virgil

0

あるURLから別のURLへリダイレクトする方法です。 Check this out

+0

私はちょうど問題を解決するために.htaccessを使用します。とにかくありがとうございました。 – Virgil