2014-02-26 5 views
0

www.ins-dev.com을 입력하여 www 및 리디렉션을 제거하는 경우 사용자가 insdev.com을 입력하면 정확한 URL로 리디렉션되도록 입력하는 경우 URL에 따라 리디렉션하려고합니다. insdede.com (http : //). 그러나 사용자가 ins-staging.com을 입력하여 https://ins-staging.com으로 리디렉션하는 경우 www가있는 경우이를 제거하고 동일한 리디렉션을 수행합니다. 그리고 마지막으로 사용자가 trac-staging.com을 입력하면 위와 같은 www와 동일한 로직을 https://ins-staging.com으로 리디렉션하고 싶습니다.URL 리디렉션에 따라 달라짐 htaccess

RewriteEngine On 
RewriteCond %{HTTPS} off [OR] 
RewriteCond %{HTTP_HOST} ^www\. [OR,NC] 

RewriteCond %{REQUEST_URI} ^ins-dev.com$ 
RewriteRule ^$ http://ins-dev.com [L,R=301] 


RewriteCond %{HTTP_HOST} ^trac-staging\.com$ [NC] 
RewriteRule^https://ins-staging.com%{REQUEST_URI} [L,R=301] 

도움의 종류에 사전에, 지금이 긴 시간 감사 파이팅 : 이것은 내가 지금 가지고있는 것입니다.

답변

0

ins-staging.com/video.php 당신은 사용할 수 있습니다 : 사용자, 예를 들어 입력하면 마지막 %{REQUEST_URI}이 목적에 재생을위한

RewriteEngine On 

RewriteCond %{HTTPS} off [OR] 
RewriteCond %{HTTP_HOST} ^www\.((?:trac-staging|ins-staging)\.com)$ [NC] 
RewriteRule^https://%1%{REQUEST_URI} [L,R=301,NE] 

RewriteCond %{HTTPS} off 
RewriteCond %{HTTP_HOST} ^www\.(.+) [NC] 
RewriteRule^http://%1%{REQUEST_URI} [L,R=301,NE] 

RewriteCond %{HTTPS} on 
RewriteCond %{HTTP_HOST} ^www\.(.+) [NC] 
RewriteRule^https://%1%{REQUEST_URI} [L,R=301,NE] 
+0

감사합니다, 나는이 시도하고 난에서 localhost로 리디렉션 해요 하나의 경우를 제외하고 모두'https : // ins-staging.com'입니다. – Wolf87