1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to disallow everyone except me with .htaccess

Discussion in 'Site & Server Administration' started by raymond222, Jul 27, 2008.

  1. #1
    Hey, everyone!

    I'd like to disallow everyone except me from my testsites main directory, but allow them access to /blog directory.

    Ok I'll try to describe what i am looking for-
    someone visits my site- since user's IP is not in my htaccess, they are redirected to /blog/
    when I visit the main directory htaccess has my IP and I can see it's content
    How can this be done?

    Thanks in advance!

    Chris
     
    raymond222, Jul 27, 2008 IP
  2. zacharooni

    zacharooni Well-Known Member

    Messages:
    346
    Likes Received:
    20
    Best Answers:
    4
    Trophy Points:
    120
    #2
    In maindir .htaccess

    In /blog .htaccess

     
    zacharooni, Jul 27, 2008 IP
    viitols likes this.
  3. raymond222

    raymond222 Active Member

    Messages:
    287
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    60
    #3
    Thanks, zacharooni!
    Everything works fine except the redirection part. Can someone please check- badguymarketing.com and see if you are redirected?

    Thanks!
     
    raymond222, Jul 27, 2008 IP
  4. zacharooni

    zacharooni Well-Known Member

    Messages:
    346
    Likes Received:
    20
    Best Answers:
    4
    Trophy Points:
    120
    #4
    ErrorDocument 403 /redirect.php

    in redirect.php

    <?PHP
    header("Location: /blog", 301);
    die();
    ?>
     
    zacharooni, Jul 27, 2008 IP
  5. raymond222

    raymond222 Active Member

    Messages:
    287
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    60
    #5
    thanks, worked like charm!
     
    raymond222, Jul 27, 2008 IP