Linux WEB

Debian 에서 mod_rewrite 활성화 하기

2008.12.12 22:31

jook 조회 수:19805

1. a2enmod 명령어로 rewrite 모듈을 활성화 한다.

 localhost:/etc# a2enmod rewrite
 Module rewrite installed; run /etc/init.d/apache2 force-reload to enable.

 a2enmod 를 실행 할 경우는 아래와 같이 /etc/apache2/mods-available/rewrite.load 파일이 /etc/apache2/mods-enabled/ 디렉토리로 링크가 생성된다.

 localhost:/etc/apache2/mods-enabled# ls -l /etc/apache2/mods-enabled/rewrite.load
 lrwxrwxrwx 1 root root 30 Dec 12 12:02 /etc/apache2/mods-enabled/rewrite.load -> ../mods-available/rewrite.load

 a2enmod 명령을 사용하지 않고 수동으로 링크를 생성해도 된다.


2. /etc/apache2/apache2.conf 파일에 아래의 내용을 추가한다.

 <IfModule mod_rewrite.c>
         RewriteEngine On
 </IfModule>



3. apache2.conf 파일의 <Directory> </Directory> 설정부분이나, 가상호스트 설정부분의 <Directory> </Directory> 설정 부분에서AllowOverride None 부분을 AllowOverride all로 수정한다.

        <Directory /home/jook/public_html/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride all
                Order allow,deny
                allow from all
                # This directive allows us to have apache2's default start page
                # in /apache2-default/, but still have / go to the right place
        </Directory>


4. apache 데몬 restart