문서 복사 내용. 원본 링크는 아래 링크들 참고
$ sudo a2enmod rewrite $ sudo systemctl restart apache2
<VirtualHost *:80>
#ServerName hiseon.me
ServerAdmin webmaster@hiseon.me
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/html/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
https://hiseon.me/server/apache-rewrite-examples/
MOD_REWRITE로 URL 다루기
https://www.lesstif.com/linux-infra-book/mod_rewrite-url-18219493.html
아차피 모드 rewrite 예제
★**********************진짜 참고가 잘되었던 문서 예제 ******************************************
1. tmax1.tmax.co.kr로 들어오는 요청을 http://www.google.com 로 redirect 할 때
RewriteCond %{HTTP_HOST} ^tmax1.tmax.co.kr$ // 앞에 ^ 뒤에 $ 는 정확한 매칭이 필요할 경우 넣는다. 빼면 이외에도 적용
RewriteRule . http://www.google.com [L]
2. tmax1.tmax.co.kr:26000/ 으로 들어오는 모든 요청에 대해 tmax1.tmax.co.kr:26000/session/index.jsp로 redirect 할 때
RewriteCond %{HTTP_HOST} ^tmax1.tmax.co.kr:26000$
RewriteRule ^/$ /session/index.jsp [R,L]
3. tmax1.tmax.co.kr:26000/session/ 요청에 대해 http://www.google.com 로 redirect 할 때
RewriteCond %{HTTP_HOST} ^tmax1.tmax.co.kr
RewriteCond %{SERVER_PORT} 26000$
RewriteCond %{REQUEST_URI} ^/session/$
RewriteRule . http://www.google.com [L]
4. tmax1.tmax.co.kr:26000/session/ 요청에 대해 tmax1.tmax.co.kr:26000/session/index.jsp 로 redirect 할 때
RewriteCond %{HTTP_HOST} tmax1.tmax.co.kr:26000$
RewriteCond %{REQUEST_URI} ^/session/$
RewriteRule . http://tmax1.tmax.co.kr:26000/session/index.jsp [R,L]
https://waspro.tistory.com/198
번외로 ssl https = http 충돌 관련 처리 방법 설정 FIX