아파치와 Zend Comunity Server를 사용하는 Windows 컴퓨터에서 CodeIgniter를 사용하고 있습니다. 내 아파치가 제대로 htaccess로 지시문을 처리하도록 구성되어 mod_rewrite를은 (을 httpd.conf) 사용할 수 있습니다 :CodeIgniter remove index.php apache mod_rewrite
는<Directory />
Options FollowSymLinks
AllowOverride FileInfo
Order deny,allow
Deny from all
</Directory>
내 뿌리는 C:\www\
하고 내 사이트는 C:\www\david\
에 위치하고 있으며 내가 http://localhost/david/
를 입력 할 때의 index.php는로드입니다 올바른 컨트롤러와 함께 http://localhost/david/index.php/Articles/
대신 http://localhost/david/Articles/
을 통해 직접 내 물건에 액세스하고 싶습니다. 이렇게하려면 아파치 재 작성 모듈을 사용해야합니다.
이렇게하려면 C:\www\david\
폴더에 .htaccess
파일을 넣었습니다. 내 구성은 기본에서 약간 다르기 때문에 내가 코드 변경의 몇 가지를 만들어
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /david/
#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^core.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#When your application folder isn't in the system folder
#This snippet prevents user access to the application folder
#Submitted by: Fabdrol
#Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin
ErrorDocument 404 /index.php
</IfModule>
:이 파일은 내가 here에서 발견 코드가 포함되어 있습니다. 나는 루트에 있지 않으므로 : 'RewriteBase/davidfrancoeur.com/'및 CodeIgniter 시스템 폴더의 이름을 바꿔 보안을 강화했습니다. RewriteCond % {REQUEST_URI}^핵심. * RewriteRule^(. *) $/index.php?/$ 1 [L]
이 작업을 수행하면 아무 문제없이 올바르게 작동해야하는데 http://localhost/david/Articles/
에 문제없이 액세스 할 수 있어야하고 http://localhost/david/core/config/config.php
에 직접 연결할 수 없어야한다고 생각합니다.
불행히도, 그것은 작동하지 않습니다, 어떤 재 작성이 완료된 것처럼 보이지 않습니다. 내가 여기서 뭔가 잘못하고있는 걸 보니? 아파치가 실제로 어떤 것을 다시 작성하는지 알 수있는 방법이 있습니까?
고마워요. 그리고 예 나는 ... :(2.0.2
편집
CI, PHP 5.3, 아파치 2.2
여전히 코어 폴더 앱 SYS 폴더에 액세스 할 가 표시됩니다. – David