2014-02-11 7 views
0

두 사이트가 하나로 통합되었습니다. 내용은 다르지만 모든 경로는 동일하므로 새 사이트의 두 개의 새 디렉토리로 이동해야합니다.301 하나의 사이트로 두 사이트 리디렉션

예 :

  • site1.com/stuff.html
  • site2.com/stuff.html

필요가되기 위해 :

  • site1.com/junk
  • site1.com/mail

.htaccess에서 301 리디렉션을 만들려면 어떻게해야합니까? 파일 이름을 동일하게 지정하고 새 사이트로 연결하기 때문에 파일을 지정할 수 있습니까?

는 지금은 이런 식으로 뭔가를 가지고,하지만 난 그게 내가 그 말이 희망

RewriteEngine ON 
Redirect /stuff.html http://site1.com/junk 

RewriteCond %{HTTP_HOST} ^site2.com 
RewriteRule ^(.*)$ http://www.site1.com/$1 [R=permanent,L] 

Redirect 301 /stuff.html http://www.site1.com/mail 

를 잘 생각하지 않습니다. 설명이 필요하면 알려주세요. 미리 감사드립니다.

p.s. site2.com의 네임 서버는 당신이 요청 된 호스트 이름에 무관되는 대신, mod_alias가를 사용하는 mod_rewrite를 고수해야

답변

0

을 site1.com을 가리키는 :

RewriteEngine On 

RewriteCond %{HTTP_HOST} ^site1\.com$ [NC] 
RewriteRule ^stuff\.html$ /junk [L,R=301] 

RewriteCond %{HTTP_HOST} ^site2\.com$ [NC] 
RewriteRule ^stuff\.html$ http://site1.com/mail [L,R=301] 
+0

우수함! 그것은 훨씬 더 의미가 있습니다. @ 존 린 감사합니다. – morocklo

관련 문제