SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard Wolf_22's Avatar
    Join Date
    Jul 2005
    Posts
    1,710
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Redirecting everyone except my two machines?

    I have the following in my .HTACCESS file:

    Code:
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REMOTE_HOST} !^127\.0\.0\.1
    RewriteCond %{REMOTE_HOST} !^159\.112\.48\.147
    RewriteCond %{REMOTE_HOST} !^159\.112\.48\.83
    RewriteCond %{REQUEST_URI} !/projects/xcs_wiki$  
    RewriteRule .* /projects/xcs_wiki [R=302,L]
    I'm trying to redirect everyone to my /projects/xcs_wiki location on my server (relative to my Apache root). I have 2 computers in all this: box1 and box2. The WAMP setup (my development environment) is on box1 but I do unauthenticated / "random visitor" testing from box 2 as it speeds up the whole process...

    Anyway, keeping the above .HTACCESS code in mind, everything seems to test perfectly fine when browsing from box2 using Firefox. When I try to browse from box1, however, I get redirected. Why is this?

    Does this have something to do with REMOTE_HOST vs. REMOTE_ADDR? Did I get that wrong?

    Basically, for me, it's nice being able to browse my directories and if I'm being redirected on box1, I can no longer browse my directories...

    Any insight into this is appreciated.

  2. #2
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,644
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    W22,

    First, for catching your localhost in your {REMOTE_ADDR} sequence. Unfortunately, you're not after {REMOTE_HOST} but {REMOTE_ADDR} to fetch the address of the visiting computer.

    Good plan, though!

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  3. #3
    SitePoint Wizard Wolf_22's Avatar
    Join Date
    Jul 2005
    Posts
    1,710
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Made the change and it seems to be working like a charm. Thanks DK.

  4. #4
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,644
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    W22,

    You're welcome!

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •