./categories/server
Apache mod_rewrite
컴파일: ./configure --prefix=/usr/local/apache2 --enable-rewrite
범위: Server Config / VirtualHost / Directory / .htaccess
지시자
RewriteEngine On|Off
RewriteLog /path/to/rewrite.log # 구버전
RewriteLogLevel 0-9 # 0=off
RewriteCond TestString CondPattern
RewriteRule Pattern Substitution [flags]
공사중 (특정 IP만 허용)
RewriteCond %{REMOTE_ADDR} !^127\.0\.0\.1
RewriteCond %{REQUEST_URI} !^/uc/
RewriteRule ^.+$ /uc/index.html [L]
플래그
Llast /R=301redirect /F403 /Cchain
예
# /user_id ��� main.php?id=
RewriteCond %{REQUEST_URI} !^/admin$
RewriteRule ^/([a-zA-Z0-9]+)$ /blog/main.php?id=$1
# 외부 리다이렉트
RewriteRule ^/external$ http://www.example.com/ [R,L]
관련 링크: https://chess72.tistory.com/35
./comments