Php - Is it possible to block access to a webpage depending on the address used? -


consider following scenario.

there site on local network can accessed 1 of 2 ways:

  1. 11.11.11.111/testsite (ip)
  2. test.site.com (vhost)

is possible php allow access using test.site.com?

edit:

while there many suggestions how solve problem, went publi design & john v.'s mod_rewrite suggestion, implemented in httpd.conf file , redirected forbidden page.

what worked me was:

rewriteengine on rewritecond %{http_host} !^test.site.com$ [nc] rewriterule .? - [f] 

i avoid php request , go 1 level. haven't tried this, maybe .htaccess file you, using similar this:

rewriteengine on rewritecond %{http_host} !^11.11.11.111/testsite$ [nc] rewriterule ^(.*)$ test.site.com/$1 [l,r=301] 

you might have play around it, imagine along lines should want be.


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -