문제

예를 들어 다음을 리디렉션하고 싶습니다.

A.olddomain.com.au/blah.html  >  A.newdomain.com/blah.html
B.olddomain.com.au/blah.html  >  B.newdomain.com/blah.html

본질적으로, 나는 변수 수의 하위 도메인을 가지고 있으며 리디렉션에서 도메인 이름 자체 만 변경하고 싶습니다.

시험해 볼 단서 나 제안이 있습니까?

감사.

도움이 되었습니까?

해결책

이것은 HTTP 사례에 대해 작동해야합니다

RewriteCond %{HTTP_HOST} (.*)\.olddomain\.com\.au
RewriteRule (.*) http://%1.newdomain.com/$1

HTTP와 HTTPS를 모두 사용하는 경우 두 가지 규칙 세트를 사용해야합니다. 하나는 HTTP 용이고 다른 하나는 HTTPS 용입니다.

RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} (.*)\.olddomain\.com\.au
RewriteRule (.*) https://%1.newdomain.com/$1

RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} (.*)\.olddomain\.com\.au
RewriteRule (.*) http://%1.newdomain.com/$1
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top