
mod_rewrite를 기반으로 하는 일반적인 Apache SPA 구성:
DocumentRoot "${webDir}"
<Directory "${webDir}">
LogLevel rewrite:trace8
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule . index.html [L]
</Directory>
마지막 규칙의 정규식을 캐럿으로 바꾸는 경우:
RewriteRule ^ index.html [L]
Apache segfault on http://localhost/
(비어 있지 않은 모든 경로에서 작동) 오류 로그가 의심스럽지 않습니다.
[rewrite:trace3] mod_rewrite.c(493): strip per-dir prefix: /home/user/work/out/ ->
[rewrite:trace3] mod_rewrite.c(493): applying pattern '^' to uri ''
[rewrite:trace4] mod_rewrite.c(493): RewriteCond: input='/home/user/work/out/' pattern='!-f' => matched
[rewrite:trace2] mod_rewrite.c(493): rewrite '' -> 'index.html'
[rewrite:trace3] mod_rewrite.c(493): add per-dir prefix: index.html -> /home/user/work/out/index.html
[rewrite:trace2] mod_rewrite.c(493): strip document_root prefix: /home/user/work/out/index.html -> /index.html
[rewrite:trace1] mod_rewrite.c(493): internal redirect with /index.html [INTERNAL REDIRECT]
점이 있는 로그(충돌이 발생하지 않음)는 다음과 같습니다.
[rewrite:trace3] mod_rewrite.c(493) strip per-dir prefix: /home/user/work/out/ ->
[rewrite:trace3] mod_rewrite.c(493) applying pattern '.' to uri ''
[rewrite:trace1] mod_rewrite.c(493) pass through /home/user/work/out/
[rewrite:trace3] mod_rewrite.c(493) strip per-dir prefix: /home/user/work/out/index.html -> index.html
[rewrite:trace3] mod_rewrite.c(493) applying pattern '.' to uri 'index.html'
[rewrite:trace4] mod_rewrite.c(493) RewriteCond: input='/home/user/work/out/index.html' pattern='!-f' => not-matched
[rewrite:trace1] mod_rewrite.c(493) pass through /home/user/work/out/index.html