htaccess request forwarding if internal ip

后端 未结 3 1607
青春惊慌失措
青春惊慌失措 2021-01-17 04:50

Is there a possible htaccess directive that can transparently forward request from index.php to index_internal.php if the request is coming from an internal ip range?

3条回答
  •  爱一瞬间的悲伤
    2021-01-17 05:31

    ok here's my code (no redirect) based on wikipedia's private network list

    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]
    

提交回复
热议问题