Routing

라우팅 소개

  • 고도몰에는 요청한 URI에 해당하는 PHP 파일이 존재하지 않습니다.
  • Application 객체에서 적절한 Controller를 찾아 실행한 결과를 되돌려 주는 형태로 동작합니다.
  • Application 객체에서는 Request(사용자 요청 정보)를 근거로, 실행해야 할 Controller를 찾기 위해 ControllerNameResolver가 구동되도록 구성되어 있습니다.

Rewrite Module 스펙

  • 어떤 Request 주소가 와도 사용자 소스 디렉토리(User Source Directory)route.php가 실행됩니다.
  • 단, 확장자가 gif, jp(e)g, png, js, css, swf, ico, eot, woff, ttf인 파일과 사용자 소스 디렉토리(User Source Directory)route.php는 제외됩니다.

Document Root 설정

  • 사용자 소스 디렉토리(User Source Directory)route.php가 위치한 root의 .htaccess 설정 내용입니다.
DirectoryIndex route.php
RewriteEngine on

RewriteCond %{REQUEST_URI} \.(gif|jpe?g|png|js|css|swf|ico|eot|woff|ttf)$ [NC,OR]
RewriteCond %{REQUEST_URI} ^/?blank\.php$
RewriteRule ^ - [L]

RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+[^\/])$ $1/

RewriteRule ^ route.php [L]

Data 디렉토리 설정

  • 사용자 소스 디렉토리(User Source Directory)data 디렉토리는 이미지 및 게시판 스킨등 사용자 정의 파일 및 웹리소스를 저장하거나 호출할 수 있습니다.
  • 필요한 확장자가 있는 경우 반드시 이곳에 추가해야 웹에서 접근이 가능합니다.
RewriteCond %{REQUEST_URI} \.(php?|htm?|log|cgi|inc|xml|json|exe|bat|sh|bash|dll)$ [NC]
RewriteRule ^ - [F]

기타 디렉토리 설정

  • 사용자 소스 디렉토리(User Source Directory)data 디렉토리을 제외한 모든 디렉토리는 웹에서 접근을 제한하기 위해 다음과 같이 설정되어 있습니다.
<IfModule mod_authz_core.c>
    Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
    Order deny,allow
    Deny from all
</IfModule>