htaccess custom 403 just for one IP

Discussion in 'Apache' started by NemoXP, Sep 15, 2007.

  1. #1
    how can i do this?
    i`ve restricted POST fot that ip and i want JUST that person to see a special 403 message or to see a different 403 error page
    something like:

    IF REMOTE_ADDR == IP
    ErrorDocument 403 specialmessage.html
    /IF


    this is how i`ve restricted POST to that ip
    <Limit POST>
    order allow,deny
    allow from all
    deny from IP
    </Limit>
    
    Code (markup):
     
    NemoXP, Sep 15, 2007 IP
  2. evera

    evera Peon

    Messages:
    283
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #2
    With this code all sites requested from the ip 127.0.0.1 (you have to change that to the Ip you want) will be redirected to specialmessage.html.
    RewriteEngine On 
    RewriteCond %{REMOTE_ADDR} ^127.0.0.1$ [NC] 
    RewriteRule ^(.*)$ http://www.domain.com/specialmessage.html [R]
    Code (markup):
     
    evera, Sep 15, 2007 IP
  3. NemoXP

    NemoXP Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    can i do this just for the 403 file? if the server sends a 403 error to that ip to rewrite the page frm 403.shtml to http://www.domain.com/specialmessage.html ?
     
    NemoXP, Sep 15, 2007 IP
  4. evera

    evera Peon

    Messages:
    283
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #4
    RewriteEngine On 
    RewriteCond %{REQUEST_URI} ^/folder/403.shtml [R,L]
    RewriteCond %{REMOTE_ADDR} ^127.0.0.1$ [NC] 
    RewriteRule ^(.*)$ http://www.domain.com/specialmessage.html [R]
    Code (markup):
    Try something like this...
     
    evera, Sep 15, 2007 IP