내부 IP 인 경우 htaccess 요청 전달
-
06-07-2019 - |
문제
요청이 내부 IP 범위에서 나오는 경우 Index.php에서 Index_internal.php로 투명하게 요청할 수있는 htaccess 지침이 있습니까?
해결책
RewriteEngine on
RewriteCond %{REMOTE_ADDR} ^192\.168\.1\. [OR]
RewriteCond %{REMOTE_ADDR} ^10\.15\.
RewriteRule ^index\.php$ index_internal.php [R,NC,QSA,L]
이것이하는 일 :
mod_rewrite 엔진을 시작하십시오 (이미 가질 수 있음)
if (클라이언트 IP 주소는 "192.168.1로 시작합니다.[또는
클라이언트 IP 주소는 "10.15"로 시작합니다.)
그리고 페이지 이름은 index.php ([n] ot [c] ase sensitive), [r] edirect to Index_internal.php, [q] uery [s] tring [a] ppend (예 : index.php?foo=bar
becomes index_internal.php?foo=bar
), [l] EAVE 처리.
IP 주소 블록에 필요에 따라 수정하십시오.
다른 팁
이와 같은 일이 있어야합니다 (네트워크와 일치하도록 IP 주소를 분명히 변경) :
RewriteCond %{REMOTE_ADDR} ^192\.168\.
RewriteRule index.php index_internal.php
실제 헤더를 원한다면 그것을 만들 수 있습니다 RewriteRule index.php index_internal.php [L,R,QSA]
좋아 여기 내 코드 (리디렉션 없음)가 있습니다. Wikipedia의 개인 네트워크 목록
RewriteEngine on
RewriteCond %{REMOTE_ADDR} ^10\. [OR]
RewriteCond %{REMOTE_ADDR} ^172\.[1-3]{1}\d{1}\. [OR]
RewriteCond %{REMOTE_ADDR} ^192\.168\.
RewriteRule ^index\.php index_internal.php [NC,QSA,L]
제휴하지 않습니다 StackOverflow