2016-08-08 6 views
0

htaccess 파일에 다음 구조가 있습니다. 내 문제는 URI가 조건에 따라 URL 리디렉션과 일치하는지, URI가 일치하지 않으면 기본 규칙이 적용되는지, 해결 방법을 알려주세요.Htaccess URL 리디렉션 오류

첫 번째 규칙 : RedirectMatch 301 /mob/(.*) http://www.newdomain.com/price/$1

기본 규칙 : 나는 다른 규칙을 무시이 기본 규칙을 시도 RedirectMatch 301 /(.*) http://www.newdomain.com/$1

.

답변

0
Assuming both domains are on the same root folder and host: 

RewriteCond %{HTTP_HOST} ^originaldomain\.com$ 
RewriteCond %{REQUEST_URI} ^/cms 
RewriteRule ^(.*)$ https://differentdomain.com/$1 [L,R=302] 
If they are not on the same root and folder: 

RewriteCond %{REQUEST_URI} ^/cms 
RewriteRule ^(.*)$ https://differentdomain.com/$1 [L,R=302] 
Now the 2nd part if the url is not a act, url, system or post: 

RewriteCond %{THE_REQUEST} !^[A-Z]{3,}\s/(act\?(.*)|url|system)$ [NC] 
RewriteCond %{THE_REQUEST} !^POST [NC] 
RewriteRule ^(.*)$ http://originaldomain.com/$1 [L,R=302] 
Basically this should work, if it does after you test change to 302 to 301 if needed. 
+0

안녕하세요, 응답 해 주셔서 감사합니다. 여기 도메인이 다르며 호스트도 있습니다. –

+0

localhost로 리디렉션 –