wanting to use php instead of htaccess for country block and redirect

Discussion in 'PHP' started by catmistress, Apr 7, 2011.

  1. #1
    Hi, I want to php instead of htaccess for country blocks including IP ranges and specific IP addresses and then redirect them to a specific html How do I do this?

    For example, one of my current htaccess files looks something like this:

    ErrorDocument 403 http://www.example.com/webmaster/Grenzkontrolle.html
    order allow,deny
    # EXAMPLE 1
    deny from 1.0.0.0/24
    deny from 1.1.1.0/24
    deny from 1.2.3.0/24
    # EXAMPLE 2
    deny from 190.210.132.105
    deny from 69.84.207.129
    allow from all

    -------------------------------
    can you help? How do I say this in php?
     
    catmistress, Apr 7, 2011 IP
  2. srisen2

    srisen2 Peon

    Messages:
    359
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    httaccess if much more direct to do this in php you have to get the host ip and then process an if statment and if it matches redirect using the header command

    it will require much more code
     
    srisen2, Apr 8, 2011 IP