기본 콘텐츠로 건너뛰기

IIS7 에서 CodeIgniter index.php 제거 하기

IIS7 에서 CodeIgniter index.php 제거 하기

테스트 환경

OS : Windows 2008 Server R2 / Windows 7 Enterprise K

웹서버 : IIS 7.5 (7.0 도 가능할거라 여겨짐)

윈도우 환경에서 IIS 7.5 환경에 PHP. 코드이그나이터(CodeIgniter) 환경을 구성하다가 index.php 를 제거하기

위해 별지랄을 다해봤다. 그러다..

http://codeigniter-kr.org/lecture/view/213/page/1 를 참조하여 응용 간단하게(?) 해결할 수 있었다.

먼저 필요 요소들에 대해서 정리해보자.

IIS 7.5 웹서버

IIS 7.5 에 PHP 설정

코드이그나이터

.htaccess 파일

IIS URL 재작성 (Rewrite)

일단 준비물은 여기까지다. 아래 그림을 보면 PHP Manager 와 URL 재작성이 설정되있는 것을 볼 수 있다.

이와 같이 됬으면 설정완료.

그리고 코드이그나이터가 설치된 경로의 application 폴더를 보면

와 같이 .htaccess 파일이 있는 것을 볼 수 있다.

해당 파일을 메모장이나 편집기로 열면

Deny from all

AllowOverride All

까지만 작성되있는 것을 볼 수 있다.

이에 아래 코드를 추가한다. 저장까지 하는걸로~

RewriteEngine On RewriteCond $1 !^(index\.php|images|captcha|data|include|uploads|robots\.txt) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php/$1 [L]

여기까지가 완료됬으면 IIS URL 재작성을 실행.

처음에는 아무것도 없다. 하지만 난 이미 추가해놨기에 나타나있다. 절차는 다음과 같다.

1. 규칙 가져오기

2. 규칙 가져오기 아래 화면에서 빨간 동그라미(?ㅋㅋㅋ) 로 체크된 부분을 선택해서 .htaccess 파일 경로를 찾아 불러온다. 그리고 가져오기 버튼을 누르면 아래처럼 재작성 규칙란에 설정된 규칙이 나타난다. 해서 여기까지 확인했으면 '적용'

3. index.php 제거 이제 여기까지 됬으면 코드이그나이터의 config.php 파일을 수정해야 한다. 간단하다. index.php 를 지워주면 된다.

$config['index_page'] = '';

해놓으면 끄읕. ㅋㅋㅋㅋㅋㅋㅋㅋ 개같이 캡쳐를 떠가면서 포스팅을 했으니 센스 댓글 해주시면 땡큐베리감사~

from http://www.jkun.net/300 by ccl(A) rewrite - 2020-03-06 11:20:44

댓글

이 블로그의 인기 게시물

[PHP] 코드이그니터 - 파일업로드 구현

[PHP] 코드이그니터 - 파일업로드 구현 파일 업로드 이번에 PHP 프레임워크인 코드 이그니터(Codeigniter)를 사용하여 홈페이지를 만드는데 사용한 이미지 업로드용 코드 입니다. upload 라이브러리를 사용하고 app~ 와 같은 위치에 upload 폴더를 만드고 다음 코드를 사용한다음 ajax 로 호출하여 파일을 업로드 합니다. function index() { // Upload 설정 $config['upload_path'] = './upload/'; $config[\'allowed_types\'] = 'gif|jpg|png'; $config['max_size'] = 100; // 100k $config['max_width'] = 1024; $config['max_height'] = 768; $this->load->library('upload', $config); $data = array(); if (! $this->upload->do_upload("service_image")) { $error = array('error' => $this->upload->display_errors()); } else { //$data = array('upload_data' => $this->upload->data()); $this->output->set_output("./upload/".$this->upload->data('file_name')); } } jquery 를 이용한 파일 업로드 호출 코드 function upload() { var datas, xhr; datas = new FormData(); datas.append( 'service_image', $( ...

2017년 1월 스타트업에서 구인할때 주로 원하는 개발 기술

2017년 1월 스타트업에서 구인할때 주로 원하는 개발 기술 php mysql linux android git kotlin gcm/fcm python mssql mongodb amazon aws ios objective-c swift github python c++ django python postgresql amazon aws html5/css3/javascript android java mysql python c++ c# java aws cloud-server dbms node.js postgresql redis nginx react.js hapi.js amazon aws restful-api angularJS jQuery html5/css3/javascript android firebase custom ui component restful-api asp.net c# html css javascript bootstrap angularjs node.js php mongodb redis 프론트엔드 주요 기술 javascript jquery ajax angularjs wbesocket html5/css3/javascript android ios java xcode node.js coffeescript mysql amazon ec2 amazon es3 android ios node.js php python java ios php mysql apache python android redis node.js jquery msa node.js java restful-api linux nosql golang redis nginx ...

이클립스 코드이그나이터 연동 ( eclipse codeigniter )

이클립스 코드이그나이터 연동 ( eclipse codeigniter ) https://ellislab.com/codeigniter/user-guide/installation/downloads.html 위의 사이트에서 코드이그나이터를 다운 받는다. 다운받은 압축 파일을 풀어 준다. 이클립스에서 php 프로젝트를 생성한 공간에 코드이그나이터 압축파일을 복사 붙여넣기 해준다. 위와 같은 화면이 나오면 정상적으로 연동이 된 것 입니다. from http://nahosung.tistory.com/22 by ccl(A) rewrite - 2020-03-06 16:20:55