테스트 사이트 - 개발 중인 베타 버전입니다

www제거 https로 접속.. 채택완료

RAEAN 2년 전 조회 13,030

</p>

<p>RewriteEngine on

RewriteCond %{HTTP_HOST} ^www\. [NC]

RewriteBase /

RewriteCond %{SERVER_PORT} 80

RewriteRule ^(.*)$ <a href="https://%{HTTP_HOST}%{REQUEST_URI}" target="_blank" rel="noopener noreferrer">https://%{HTTP_HOST}%{REQUEST_URI}</a> [R,L]</p>

<p>

 

사이트 접속시 www 제거하고 무조건 https로 들어오게 htaccess 파일을 이용해서 사용중입니다.

여기서 이런 질문하면 안될것 같은데요..

 

혹시 asp에선 위와 같이 적용하려면 어떤 파일 어떤식으로 표기를 해야 하나요.?

댓글을 작성하려면 로그인이 필요합니다.

답변 4개

채택된 답변
+20 포인트
A
2년 전

</p>

<p><%@ Language=VBScript %>

<%

If InStr(1, Request.ServerVariables("HTTP_HOST"), "www.", vbTextCompare) = 1 Then

    Dim redirectURL 

    redirectURL = "<a href="https://"" target="_blank" rel="noopener noreferrer">https://"</a> & Mid(Request.ServerVariables("HTTP_HOST"), 5) & Request.ServerVariables("URL")

    Response.AddHeader "Location", redirectURL

End If

%></p>

<p>

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

해피정
2년 전

https://www.happyjung.com/lecture/146

정리된 자료입니다.

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

웅푸
2년 전

asp는 IIS 웹서버에서 돌아가기 때문에 htaccess 파일을 사용할 수 없죠.

대신에 IIS에서 URL 재작성 모듈을 설치하고

web.config 파일에 리다이렉트 규칙을 작성해야 해야합니다.

따라서 URL 리디렉션 및 리라이팅을 지원하는 rewrite 모듈을 사용할 수 있습니다

 

<code> <rewrite> <rules> <rule name=“Remove WWW and force HTTPS” stopProcessing=“true”> <match url=“(.)" /> <conditions logicalGrouping=“MatchAny”> <add input=“{HTTP_HOST}” pattern="^www.(.)$” /> <add input=“{HTTPS}” pattern=“off” /> </conditions> <action type=“Redirect” url=“https://{C:1}/{R:1}” redirectType=“Permanent” /> </rule> </rules> </rewrite> </code>
 

아래 링크는 참고자료입니다.

https://learn.microsoft.com/ko-kr/troubleshoot/developer/webapps/aspnet/development/application-directory-configuration">ASP.NET 애플리케이션 구성 - ASP.NET | Microsoft Learn

https://bluescoder.com/https%ec%99%80-%eb%8f%84%eb%a9%94%ec%9d%b8%ec%9d%98-www-%eb%a6%ac%eb%8b%a4%ec%9d%b4%eb%a0%89%ed%8a%b8-%ec%b2%98%eb%a6%ac/">HTTPS와 도메인의 www 리다이렉트 처리 | Blues Coder

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인