2016-08-29 2 views
3

나는 htaccess로 다음RewriteBase - 동일한 디렉토리로 안내합니까? 지금 내가 컨트롤러 <code>mycontroller</code>에 도착 링크 <code>http://example.com/mycontroller/</code> 클릭하면

RewriteEngine On 

RewriteBase/

RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^(.+)$ index.php?controller=$1 [QSA,L] 

으로 자신에게 작은 MVC를 구축 .. 모든 것이 여기에 잘 작동합니다.

하지만 http://example.com/mycontroller/ 안에 내가 http://example.com/mycontroller/mycontroller/edit/1에 저를 이끌어 추가 링크 즉 http://example.com/mycontroller/edit/1이 (?)

어떻게이 될 수 있는가? 이 문제를 어떻게 해결할 수 있습니까?

+0

사람이 읽을 수있는 URL을 사용하고 있기 때문에 MVC가되지 않습니다. –

+0

나는 codeigniter를 사용하고 있다고 생각하십니까? –

답변

1

HTML의 링크 모양은 어떻습니까?

<a href="/mycontroller/edit/1" ... 또는 <a href="mycontroller/edit/1" ...?

후자는 현재 경로를 기준으로, 당신은 /mycontroller/ 이미있을 때, 당신의 링크가 서버 상대하기 위해 필요한이 문제를 해결하기 위해 /mycontroller/mycontroller/edit/1

로 확장 (즉, /로 시작됩니다)

+0

젠체하는 .. 감사합니다! :) – crunchy