2012-06-13 3 views
1

예를 들어 액세스 할 수있는 방법이 있습니다. prolink.php mydomain.com/prolink.php을 입력하여 젠드/공공 디렉토리에있는 파일 및 이동 다른 경우 (의 index.php)에서 응용 프로그램에젠드 htaccess 공개 PHP 파일

RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} -s [OR] 
RewriteCond %{REQUEST_FILENAME} -l [OR] 
RewriteCond %{REQUEST_FILENAME} -d 
RewriteRule ^.*$ - [NC,L] 
RewriteRule ^.*$ index.php [NC,L] 

은 그에 대한 경로를 지정해야합니까? 요청은 index.php를가 제공되지 않는 서버에 이미 존재하는 파일 인 경우

+1

다른 라인보다'RewriteRule의^prolink.php의 $/공공/prolink.php' 추가 공용 폴더 로 파일을 루트 폴더에 htaccess로 넣고, 마녀 내용의 index.php 넣어 . – Gerben

+0

RewriteRule은 괜찮지 만 RewriteCond % {REQUEST_FILENAME}을 사용하여 수행했습니다! -f – Wojciechk

답변

1
RewriteEngine On 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^prolink.php$ public/prolink.php 

RewriteCond %{REQUEST_FILENAME} -s [OR] 
RewriteCond %{REQUEST_FILENAME} -l [OR] 
RewriteCond %{REQUEST_FILENAME} -d 
RewriteRule ^.*$ - [NC,L] 
RewriteRule ^.*$ index.php [NC,L] 

한다 RewriteCond % {REQUEST_FILENAME}는! 을 -f.

+0

잘 작동합니다. (아마도'-f' 조건을 두 번째 규칙에 추가하기를 원할 것입니다.) – Gerben

0

RewriteEngine On 

RewriteRule ^\.htaccess$ - [F] 

RewriteCond %{REQUEST_URI} ="" 
RewriteRule ^.*$ /public/index.php [NC,L] 

RewriteCond %{REQUEST_URI} !^/public/.*$ 
RewriteRule ^(.*)$ /public/$1 

RewriteCond %{REQUEST_FILENAME} -f 
RewriteRule ^.*$ - [NC,L] 

RewriteRule ^public/.*$ /public/index.php [NC,L] 

Options -Indexes