로컬로 개발하기 위해 wamp를 사용하여 (Apache 2.4) codeIgniter에서 프로젝트를 만들고 있습니다. 프로젝트 전체에서 나는 mod_rewrite를 켜서 codeigniter 프로젝트 디렉토리에있는 .htaccess
파일 (즉 C:\wamp\www\codeIgniter\.htaccess
)을 사용하여 기본적으로 codeigniter의 URL에 나타나는 index.php
을 제거했습니다. 서버 설정에서 sspi 규칙을 적용한 후에 mod_rewrite가 더 이상 적용되지 않습니다.
c:wamp\bin\apache\Apache2.4.4\conf\httpd.conf
<Directory "c:/wamp/www/codeIgniter">
AllowOverride None
Options None
Order allow,deny
Allow from all
AuthName "protected"
AuthType SSPI
SSPIAuth On
SSPIAuthoritative On
SSPIOmitDomain On
require valid-user
</Directory>
의 httpd.conf 파일에 다음을 적용했다.
httpd.conf
파일을 변경 한 후 mod_rewrite 규칙이 더 이상 적용되지 않는 것으로 보입니다.로드 할 URL을 얻으려면 프로젝트 루트 뒤에 index.php
을 써야합니다.
In general, you should only use .htaccess files when you don't have access to the main server configuration file. There is, for example, a common misconception that user authentication should always be done in .htaccess files, and, in more recent years, another misconception that mod_rewrite directives must go in .htaccess files. This is simply not the case. You can put user authentication configurations in the main server configuration, and this is, in fact, the preferred way to do things. Likewise, mod_rewrite directives work better, in many respects, in the main server configuration. Link
을 그래서 먼저 난 :
httpd.conf
설정하고 .htaccess 파일은 서버 설정에 액세스가 가능하면 사용하지 않아야하는 것이 좋습니다 .htaccess
파일을 설정하는 아파치 문서의 일부를 읽은 후 내 mod_rewrite 규칙을 내 sspi 항목과 함께 다시 행복하게 처리 할 수있는 방법과 두 번째로 내 mod_rewrite 규칙을 .htaccess에서 내 서버 config 파일 httpd.conf으로 옮길 수있는 방법을 이해하려고합니다.
나는 위에서 언급 한 코드 에서처럼 서버 구성에서 AllowOverride All
을 전환하려고 시도했지만 이것이 모든 것을 액세스 할 수 없게 만드는 것 같습니다. 나는 또한 Order allow,deny
및 Allow from all
을 Require all granted
으로 변경하려고 시도했지만 비슷한 문제가있는 것으로 보입니다. mod_rewrite 규칙을 서버 설정에 추가하면 모든 것을 액세스 할 수 없게됩니다. 어떤 지침이라도 대단히 감사 할 것입니다! 고맙습니다. 다음과 같이
내 .htaccess
은 다음과 같습니다
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /codeIgniter
#RewriteBase /codeIgniter
#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} ^system.*
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 acces 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 !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
답장과 링크에 감사드립니다. 'AllowOverride None'을'AllowOverride FileInfo' 나'AllowOverride All'로 바꾸거나 주석으로 처리한다면,'와 같이 이전 지시어를 취하는 것으로 가정합니다.'Allow from all '다음 403 오류가 발생합니다 : ** 금지됨이 서버에서/codeIgniter /에 액세스 할 수있는 권한이 없습니다. **이 오류 페이지가 나타나는 이유를 이해할 수 없습니다. AllowOverride All' 또는'FileInfo' .htaccess가 금지 된 오류를 발생시키지 않는다고 가정하는 재 작성 작업을 수행하도록 허용하고 있습니다. –
haakym
내가 이전에 언급 한 " c :/wamp/www">와 같이 이전 지시문을 사용한다고 가정 할 때 "AllowOverride All"이 있습니다. –
haakym