# Routing 소개

## 📌 라우팅 소개

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

## 📌 Rewrite Module 스펙 <a href="#rewrite-module" id="rewrite-module"></a>

* 어떤 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` 설정 내용입니다.

```xml
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` 디렉토리는 이미지 및 게시판 스킨등 사용자 정의 파일 및 웹리소스를 저장하거나 호출할 수 있습니다.
* 필요한 확장자가 있는 경우 반드시 이곳에 추가해야 웹에서 접근이 가능합니다.

```xml
RewriteCond %{REQUEST_URI} \.(php?|htm?|log|cgi|inc|xml|json|exe|bat|sh|bash|dll)$ [NC]
RewriteRule ^ - [F]
```

**기타 디렉토리 설정**

* `사용자 소스 디렉토리(User Source Directory)` 내 `data` 디렉토리을 제외한 모든 디렉토리는 웹에서 접근을 제한하기 위해 다음과 같이 설정되어 있습니다.

```xml
<IfModule mod_authz_core.c>
    Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
    Order deny,allow
    Deny from all
</IfModule>
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://devcenter-help.nhn-commerce.com/guide/preparation/detailed-structure/routing.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
