2016-12-05 4 views
2

하루 종일이 작업을하고 있으며 제대로 작동하지 않습니다. 나는 htaccess로 파일을 다음과 생성 10월 CMS를 사용하고 있습니다 : 나는 또한/양식/디렉토리에있는 contact.php 파일을 가지고 .htaccess에 화이트리스트 PHP 스크립트가 있습니다.

<IfModule mod_rewrite.c> 

<IfModule mod_negotiation.c> 
    Options -MultiViews 
</IfModule> 

RewriteEngine On 

RewriteRule ^(form/contact.php)($|/) - [L] 
## 
## You may need to uncomment the following line for some hosting environments, 
## if you have installed to a subdirectory, enter the name here also. 
## 
# RewriteBase/

## 
## Black listed folders 
## 
RewriteRule ^bootstrap/.* index.php [L,NC] 
RewriteRule ^config/.* index.php [L,NC] 
RewriteRule ^vendor/.* index.php [L,NC] 
RewriteRule ^storage/cms/.* index.php [L,NC] 
RewriteRule ^storage/logs/.* index.php [L,NC] 
RewriteRule ^storage/framework/.* index.php [L,NC] 
RewriteRule ^storage/temp/protected/.* index.php [L,NC] 
RewriteRule ^storage/app/uploads/protected/.* index.php [L,NC] 

## 
## White listed folders 
## 
RewriteCond %{REQUEST_FILENAME} -f 
RewriteCond %{REQUEST_FILENAME} !/storage/app/uploads/.* 
RewriteCond %{REQUEST_FILENAME} !/storage/app/media/.* 
RewriteCond %{REQUEST_FILENAME} !/storage/temp/public/.* 
RewriteCond %{REQUEST_FILENAME} !/form/.* 
RewriteCond %{REQUEST_FILENAME} !/themes/.*/(assets|resources)/.* 
RewriteCond %{REQUEST_FILENAME} !/plugins/.*/(assets|resources)/.* 
RewriteCond %{REQUEST_FILENAME} !/modules/.*/(assets|resources)/.* 
RewriteCond !^index.php index.php [L,NC] 
RewriteCond %{REQUEST_FILENAME} !/new/.* 

## 
## Block all PHP files, except index 
## 
RewriteCond %{REQUEST_FILENAME} -f 
RewriteCond %{REQUEST_FILENAME} \.php$ 
RewriteRule !^index.php index.php [L,NC] 
##RewriteCond %{REQUEST_FILENAME} -f 
##RewriteCond %{REQUEST_FILENAME} \.php$ 
##RewriteRule !^contact.php contact.php [L,NC] 

## 
## Standard routes 
## 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule^index.php [L] 

. 내가 원한 것은 POST를 사용할 때 contact.php가 실행되도록 허용하는 것이다. WordPress 또는 joomla로 나는 그런 문제를 만나지 않았다. 또한 htaccess를 배우기위한 좋은 자습서가 있습니까?

답변

0

이 작업을 수행 하시겠습니까? filename이 contact.php 일 때 조건을 추가합니다. 여기에 튜토리얼 다시 작성하는 것입니다 https://httpd.apache.org/docs/current/mod/mod_rewrite.html

## 
## Block all PHP files, except index 
## 
RewriteCond %{REQUEST_FILENAME} -f 
RewriteCond %{REQUEST_FILENAME} \.php$ 
RewriteCond %{REQUEST_FILENAME} !^contact.php$ ## this is new condition 
RewriteRule !^index.php index.php [L,NC] 
+0

이 주셔서 감사합니다 제목 섹션으로 시간, 불행히도 그것은 작동하지 않는 것 같습니다 - 나는 직접 브라우저 또는 게시판에서 연락 양식으로 이동하려고 할 때 여전히 403 오류가 발생합니다./ – engray

+0

그리고 "##를 제외한 모든 PHP 파일을 차단하십시오."라는 명령을 제거하면 작동합니까? – Fanda36

+0

또는 ## 앞에 모든 PHP 파일을 차단하십시오 (색인 제외)) : – Fanda36

0

추가 라인을 최종 선 위에 White listed folders 섹션에 RewriteRule

RewriteCond %{REQUEST_FILENAME} !your-file\.php

을 주석 Block all PHP files, except index

관련 문제