라이브러리

[APACHE] Redirect - 특정 URL 요청을 다른 URL로 리다이렉트합니다.




APACHE httpd.conf 에서 Redirect

Apache 웹 서버는 `httpd.conf` 파일에서 Redirect를 설정할 수 있습니다. Redirect는 클라이언트가 요청한 URL을 다른 URL로 리다이렉트하는 기능입니다. Redirect는 클라이언트의 요청을 변경하여 다른 URL로 이동시킬 수 있습니다.

Redirect 종류

Apache에서는 두 가지 종류의 Redirect가 있습니다.

1. Permanent Redirect (301): 클라이언트가 요청한 URL을 영구적으로 다른 URL로 이동시킵니다. 이 Redirect는 클라이언트가 요청한 URL을 변경하여 다른 URL로 이동시킵니다.
2. Temporary Redirect (302): 클라이언트가 요청한 URL을 일시적으로 다른 URL로 이동시킵니다. 이 Redirect는 클라이언트가 요청한 URL을 변경하여 다른 URL로 이동시킵니다.

Redirect 설정

Redirect 설정은 `httpd.conf` 파일의 ``나 `` 섹션에 추가할 수 있습니다. Redirect 설정은 다음과 같이 구성할 수 있습니다.

#hostingforum.kr
bash

Redirect [옵션] URL



옵션은 다음과 같습니다.

* `permanent` 또는 `permanent=301`: 영구 Redirect
* `temp` 또는 `temp=302`: 일시 Redirect
* `gone` 또는 `gone=410`: 리소스가 삭제된 경우

예제:

#hostingforum.kr
bash

# 영구 Redirect

Redirect permanent /old-url http://example.com/new-url



# 일시 Redirect

Redirect temp /old-url http://example.com/new-url



# 리소스가 삭제된 경우

Redirect gone /old-url



Redirect 예제

예를 들어, `http://example.com/old-url`를 `http://example.com/new-url`로 Redirect하고 싶다면, 다음과 같이 설정할 수 있습니다.

#hostingforum.kr
bash

Redirect permanent /old-url http://example.com/new-url



이 설정을 적용하면, 클라이언트가 `http://example.com/old-url`를 요청하면, 자동으로 `http://example.com/new-url`로 Redirect됩니다.

Redirect 특수한 경우

Redirect는 특수한 경우를 다룹니다. 예를 들어, `http://example.com/old-url`를 `http://example.com/new-url`로 Redirect하고 싶지만, `http://example.com/old-url`가 `/` 경로에 위치하는 경우, 다음과 같이 설정할 수 있습니다.

#hostingforum.kr
bash

Redirect permanent /old-url http://example.com/new-url



이 설정을 적용하면, 클라이언트가 `http://example.com/old-url`를 요청하면, 자동으로 `http://example.com/new-url`로 Redirect됩니다.

Redirect는 URL 경로를 변경하여 다른 URL로 이동시킬 수 있습니다. Redirect는 클라이언트의 요청을 변경하여 다른 URL로 이동시킬 수 있습니다. Redirect는 영구 Redirect와 일시 Redirect를 지원합니다. Redirect는 특수한 경우를 다룹니다. Redirect 설정은 `httpd.conf` 파일의 ``나 `` 섹션에 추가할 수 있습니다.
  • profile_image
    나우호스팅 @pcs8404 

    호스팅포럼 화이팅!

    댓글목록

    등록된 댓글이 없습니다.

  • 전체 10,077건 / 13 페이지

검색

게시물 검색