CI 묻고 답하기

제목 컨트롤러 주소에 관하여..
글쓴이 parch 작성시각 2013/11/04 22:36:09
댓글 : 1 추천 : 0 스크랩 : 0 조회수 : 16014   RSS
www.test.com/ 으로 접속하면 routes.php 설정된 main 이라는 화면이 정상적으로 출력됩니다.
여기서 컨트롤러가 아래처럼 셋팅이 되어있는데 test.com/agreement 로 접속하면 404 error 이 뜨면서 안되네요..
nginx 사용중이고 rewrite rules 는 
    location / {
        try_files $uri $uri/ /index.php;
    }
이렇게 되어있습니다.

test.com/main/agreement 로 접속하면 접속이 됩니다.

설정에서 뭐가 잘못되어있는건지 제가 설정을 제대로 안한건지 아니면 원래 이렇게 접근을 해야 하는건지 궁금하네요..^^

test.com/agreement 로 뜨는 방법이 있을까요?
 
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Main extends CI_Controller {

 public function index()
 {
  $this->load->view('header');
  $this->load->view('main');
  $this->load->view('footer');
 }

 public function agreement()
 {
  $this->load->view('header');
  $this->load->view('pages/agreement');
  $this->load->view('footer');
 }

 public function privacy()
 {
  $this->load->view('header');
  $this->load->view('pages/privacy');
  $this->load->view('footer');
 }

 public function estimate()
 {
  $this->load->view('header');
  $this->load->view('pages/estimate');
  $this->load->view('footer');
 }
}

 다음글 왜 저는 다운로드 할때 다운로드창이 안뜨는거죠>? (5)
 이전글 자동으로 예약 시간에 특정 기능을 수행하게 할 수 있는... (2)

댓글

criuce / 2013/11/05 01:56:41 / 추천 0
접근방법이 틀리셨어요.

예를들어 test.com/agreement 로 접속했을때 main/agreement 를 호출하려면

routes.php 파일에

$route['agreement'] = 'main/agreement';

이런식으로 설정을 해주셔야 합니다.