2013-08-05 2 views
0

도메인이 하나 있습니다. abc.ca가 이미 실행 중입니다. & Google에서 해당 URL을 크롤링했습니다. 한 도메인에서 다른 도메인으로 리디렉션하는 방법은 무엇입니까?

지금 내가 abc.com

갈거야 그래서 내가 관리 할 수있는 방법 모든 URL의 abc.ca의 -> abc.com

htacees를 사용하여. 사이트는 PHP Joomla에 내장되어 있습니다.

abc.ca/def.html -> abc.com/def.html

페이지의 수천이있다. htaccess에 개별 301 리디렉션을 쓸 수 없습니다. 우리는 PHP

$uri = "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; 
$newUrl = str_replace(".ca", ".com", $uri); 
header("Location: " . $newUrl); 

그것은 PHP 사이트 또는 htaccess로 사이트에서 할 더 나은이 작업을 수행 할 수 있습니다

?

답변

1

이 작업을 시도 할 수 있습니다 :

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

나는에 simmilar 문제를했지만, 도메인 간 나는이를 통해 내 문제를 해결있어 하나

Click Here

했다.

비슷한 두 도메인에서 dns의 cname 항목을 통해 수행 할 수도 있습니다.

0

나는 그것을 테스트하지 않았다 그러나 그것은 다음과 같이해야합니다 :

다른
RewriteEngine On 
RewriteCond %{HTTP_HOST} ^abc.ca$ [OR] 
RewriteCond %{HTTP_HOST} ^www.abc.ca$ 
RewriteRule (.*)$ http://www.abc.com/$1 [R=301,L] 

Redirect 301 /old/old.htm http://www.domain.com/new.htm 

당신이 당신을이

<FilesMatch "\.(tpl|ini|log)"> 
Order deny,allow 
Deny from all 
</FilesMatch> 
    RewriteBase/
    RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L] 
    RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L] 
    RewriteRule ^download/(.*) /index.php?route=error/not_found [L] 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css) 
    RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA] 

시도이 question

0

를 살펴 할 수 있습니다 귀하의 도메인 이름에 RewriteBase /을 수정할 수 있습니다. 하위 도메인에 대한 내용은 RewriteBase /subfolder

관련 문제