[Linux] .htaccess 파일 > Linux/Apm

본문 바로가기
사이트 내 전체검색

Linux/Apm

[Linux] .htaccess 파일

페이지 정보

작성자 sbLAB 댓글 0건 조회 3,265회 작성일 22-12-18 01:58

본문


아파치 웹서버 메뉴얼에서 웹폴더에 .htaccess 파일을 직접 생성하는 방식을 성능상 권장하지 않는다.

아파치 웹서버 httpd.conf 에서 <Directory ...> 설정 이용을 권장함.

.htaccess 사용은 서버관리 권한 없는 경우만  제한적으로 사용 .htaccess 는 디렉토리 웹 접근할때 마다 .htaccess 탐색 과정 발생 . 


예를들어 D:/xampp/htdocs/jp  디렉토리에 .htaccess 파일을 아래 내용으로 생성할 수 있으나... 

   <IfModule mod_rewrite.c> 

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php [NC,L]

   </IfModule>


  ▽

  ▽


[아파치 웹서버 httpd.conf 파일에 설정하는 것을 권장한다. - 서버 시작할 때 1번만 설정 로드됨]

.htaccess 를 사용하지 않을 것이므로  AllowOverride None 으로 설정한다. 


<Directory "D:/xampp/htdocs/jp">

   <IfModule mod_rewrite.c>

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php [NC,L]

   </IfModule>


   Options Indexes FollowSymLinks Includes ExecCGI

   AllowOverride None

   Require all granted

</Directory>



https://httpd.apache.org/docs/2.4/ko/howto/htaccess.html 

https://stackoverflow.com/questions/17140605/apache-htaccess-rewrite-can-i-move-this-into-httpd-conf 

댓글목록

등록된 댓글이 없습니다.

회원로그인

접속자집계

오늘
319
어제
342
최대
1,279
전체
218,554

그누보드5
Copyright © sebom.com All rights reserved.