개발/php

코드이그나이터4 index.php 죽이기라고 함 없애기

yy_dd2 2023. 1. 23. 02:03
반응형

index.php 링크를 제거하고싶음

이렇게 하고나서 보니 CI3과 다르게 CI4에서 url 과정에 문제가 발생해서 변경
<a href="/ci_web/public/index.php/main/get/<?php echo $entry->id;?>"><?php echo $entry->title;?></a>

ci_web은 프로젝트 폴더 public과 index.php까지 써야함
../으로 하면 보기안의 리스트페이지에서 이상한 곳으로감

app>config>Routes.php에서
$routes->get('main', 'Main::index'); 작성으로 없애버림

<a href="/ci_web/public/main/get/<?php echo $entry->id;?>"><?php echo $entry->title;?></a>

참고 1 
http://ci4doc.cikorea.net/incoming/routing.html

 

URI 라우팅(Routing) — CodeIgniter 4.2.11 documentation

경로(route)를 만드는 모든 메소드(add, get, post, resource etc)는 생성된 경로를 수정하거나 추가로 제한할 수 있는 옵션을 배열로 취할 수 있습니다. $options 배열은 항상 마지막 매개 변수(parameter)입니

ci4doc.cikorea.net

 

 

반응형