2011-12-09 3 views
0

나는 CodeIgniter와 .htaccess을 사용하여 URL을 다시 작성하지만 이것을 index.html으로 무시하고 싶습니다.htaccess rewriterule index.html을 무시하십시오.

index.html은 임시 방문 페이지이므로 언제든지 업로드 할 수 있습니다. index.php의 메인 사이트 링크가 있습니다.

.htaccess 현재 나는 당신이 정말 존재하지 않는 모든 것을 다시 할 것처럼 오히려 보인다 도움

답변

4

에 대한 index.html index.php

RewriteEngine on 

RewriteCond $1 !^(index\.html|index\.php|js|img|fonts|data|css|uploaded|mobile_devices|audioplayer|emails|robots\.txt|archive_blog) 

RewriteRule ^(.*)$ /index.php/$1 [L] 

덕분에 서버의 디렉토리 인덱스를 설정 한 것입니다 귀하의 디렉토리에.

현재한다 RewriteCond 대신이 시도 :

RewriteCond %{SCRIPT_FILENAME} !-f 
RewriteCond %{SCRIPT_FILENAME} !-d 
RewriteRule ^(.*)$ index.php/$1 
0

은 왜이 environment 기능 내장 사용하지 않는?

'유지 관리'환경을 만들고 기본 컨트롤러를 원하는대로 설정할 수 있습니다. 그런 다음 index.php 파일을 편집하여 원하는 환경을 지정하기 만하면됩니다.

2

RewriteCond를 사용하여 index.html 파일을 무시하는 대신 FilesMatch 지시문을 사용하여 직접 액세스를 제한 할 수 있습니다. FilesMatch는 파일 이름 (예 : index.html)이나 정규식을 기준으로 필터링 할 수있는 정규식을 허용합니다.

완전히 index.html 파일에 대한 액세스를 거부 할 index.html 파일

<FilesMatch "index\.html$"> 
    Order allow,deny 
</FilesMatch> 

에 대한 액세스를 차단. 나는 이것이 검색 엔진 크롤링에 미칠 부정적인 영향을 알지 못한다는 것을 인정할 것이다. 현재이 그 목록에있는 디렉토리의 나머지 부분에 관해서는 http://httpd.apache.org/docs/current/mod/core.html#filesmatch


를 참조

가 FilesMatch 지침에 대한 자세한 내용을 읽으려면 관계없이 이름의 모든 디렉토리 액세스를 잠글 단지 수 있습니다. 앞으로 나아갈 범위가 좀 더 넓어 질 것입니다.

# Protect specific files from access 
<FilesMatch "index\.html$"> 
    Order allow,deny 
</FilesMatch> 

# Hide directory listing for URL's mapping to a directory 
Options -Indexes 

# Follow all symbolic links in this directory 
Options +FollowSymLinks 

# General rewrite rules 
<IfModule mod_rewrite.c> 
    RewriteEngine on 

    RewriteBase/

    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)$ index.php/$1 [L,QSA] 
</IfModule> 
: 결국 http://httpd.apache.org/docs/current/mod/core.html#options


를 참조

Options -Indexes 

새 htaccess로 파일을 다음과 같이 보일 것이다 옵션 지침에 대한 자세한 내용을 읽으려면