2013-03-01 4 views
0

나는 내 문제에 대한 해결책을 찾아 다녔다. 그래서 나는 이것이 중복 질문이라고 생각하지 않는다.htaccess 301 다른 도메인으로 리디렉션

301 blog.newexample.com에 blog.example.com 리디렉션 :

나는 다음을 수행해야합니다.

내가 가지고있는 것은 일에 가깝습니다. blog.example.com의 홈페이지로 이동하면 blog.newexample.com으로 완벽하게 리디렉션됩니다. 그러나 blog.example.com/directory/page로 이동하면 blog.newexample.com/directory/page로 이동하지 않습니다. 여기

처럼 내 htaccess로 보이는 것입니다 : 나는 당신의 문제가 무엇인지 이해하기가 확실하지 않다

# BEGIN WordPress 
<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase/
RewriteRule ^index\.php$ - [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L] 

RewriteCond %{HTTP_HOST} !newexample.com$ [NC] 
RewriteRule ^(.*)$ http://blog.newexample.com/$1 [L,R=301] 
</IfModule> 

# END WordPress 

답변

0

, 그러나 이것은 잘 작동합니다 :

<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase/

RewriteCond %{HTTP_HOST} !newexample.com$ [NC] 
RewriteRule ^(.*)$ http://blog.newexample.com/$1 [L,R=301] 
</IfModule> 

의 URL http://website.com/hello/world/ 나를 리디렉션 ~ http://blog.newexample.com/hello/world/.

+0

나는 website.com/hello/world를 변경하고 싶지 않습니다. blog.newexample.com/hello/world로 이동하기 위해 blog.website.com/hello/world를 변경하고 싶습니다. 기본적으로 도메인을 변경하려고합니다. 하위 도메인과 경로는 동일하게 유지되어야합니다. – Dustin

+0

사실 그것은 일반적인 웹 사이트 URL을 넣는 것이었지만 내 자신의 하위 도메인 .domain.tld/somedir/hello/world에서 시도했지만 작동했습니다. 또한 귀하와 같은 모든 도메인 및 하위 도메인에서 작동해야합니다. – Arthur