Results 1 to 9 of 9

Thread: IP redirect

  1. #1
    rlhanson's Avatar
    rlhanson is offline Master Glow Jedi
    Join Date
    Aug 2007
    Location
    Chapman, Kansas
    Posts
    531

    Default IP redirect

    I have a hosting client which has a secure survelliance camera on her own server.
    Her previous web designer created the password file (.apw) password protected, and the flash file protected.

    Her login screen essentially went to http://123.123.123.123 (example)
    I need to redirect it to this: http://123.123.123.124

    how exactly would I do that with the .htaccess?
    Thank you,
    Lynne Hanson
    RL Hanson-Online

  2. #2
    rlhanson's Avatar
    rlhanson is offline Master Glow Jedi
    Join Date
    Aug 2007
    Location
    Chapman, Kansas
    Posts
    531

    Default

    thinking about this...wouldn't her server admin have to do the redirect on her server?
    Thank you,
    Lynne Hanson
    RL Hanson-Online

  3. #3
    Alexander's Avatar
    Alexander is offline Technical Analyst
    Join Date
    Jul 2007
    Posts
    1,376

    Default

    Actually, the situation is not quite clear for me. Maybe, if you describe the problem more detail, I'd be able to suggest something for you. The simple redirect in .htaccess works in such a way:
    Code:
    Redirect permanent /folder http://www.example.com/newfolder

  4. #4
    rlhanson's Avatar
    rlhanson is offline Master Glow Jedi
    Join Date
    Aug 2007
    Location
    Chapman, Kansas
    Posts
    531

    Default

    Thanks for responding Alexander!
    I was having a "no brainer" moment.... I can't do a redirect on our server that would affect her server. So, when the brain started working again, I just created a new login script to go to the correct IP.

    Her server admin said that the IP doesn't reset when they restart the server, however, everything worked fine up until that point. At least with the new script if the IP changes again, I can just modify the script.

    I did need to know how to do a redirect though, so as always, very helpful info from GH!
    Thank you,
    Lynne Hanson
    RL Hanson-Online

  5. #5
    charlesh's Avatar
    charlesh is offline Master Glow Jedi
    Join Date
    Aug 2006
    Location
    Atlanta, GA - better than you imagined it would be.
    Posts
    189

    Default

    In php it works really well too, to do a simple redirect by:

    Code:
    header("Location: http://www.redirecturl.com/");
    You can also force a page to https:// or back to http:// for secure sites in php. I know you can do this in .htaccess, but this has worked for me. Basically, you could would call forcehttps(); or killhttps(); for those pages that you want to secure or unsecure:
    Code:
    function forcehttps(){
            if (!isset($_SERVER['HTTPS']))
            
            {
                $ref = $_SERVER['REQUEST_URI'];
                header("Location:https://www.securesite.com".$ref);
                exit;
            
            }
    
    }
    function killhttps(){
            if (isset($_SERVER['HTTPS']))
            
            {
                $ref = $_SERVER['REQUEST_URI'];
                header("Location:http://www.nonsecure.com".$ref);
                exit;
            
            }
    
    }
    Now, it would be good to find a better way to secure subdirectories from browsing - I have in the past included a simple index.php with nothing in it, just to make the sub-directory inaccesible. I know there must be a better way in htaccess to do that, but from what I've seen it is a bit more verbose. Maybe there is a reason I don't need to include an empty index file in my subdirectories, but it has worked so far.

    Charles

  6. #6
    rlhanson's Avatar
    rlhanson is offline Master Glow Jedi
    Join Date
    Aug 2007
    Location
    Chapman, Kansas
    Posts
    531

    Default

    Thanks for the response CharlesH!

    I have in the past included a simple index.php with nothing in it, just to make the sub-directory inaccesible.
    I actually place an index file with the "You have accessed an unauthorized area, please visit..." in the directories I want to stop browsing. I haven't tried a redirect for the directories yet though.
    Thank you,
    Lynne Hanson
    RL Hanson-Online

  7. #7
    Matt's Avatar
    Matt is offline GlowHost Administrator
    Join Date
    Jan 2005
    Location
    Behind your monitor
    Posts
    5,350

    Default

    Index files are a good protection for visitors that haven't seen the site yet, but if google came through and crawled the directory before you put your index.php up, it"s possible that the direct links to files in a specified directory are still accessable via web through links on the google (or whatever) SERPs.
    Send your friends and site visitors to GlowHost and get $125 plus bonus!
    GlowHost Affiliate Program | Read our Blog | GlowHost's Facebook | Follow us on Twitter | GlowHost on Google+

  8. #8
    rlhanson's Avatar
    rlhanson is offline Master Glow Jedi
    Join Date
    Aug 2007
    Location
    Chapman, Kansas
    Posts
    531

    Default

    Should I have a redirect for specific files in addition to an index file in the directories I want to protect? Or just redirect the whole directory would probably be better..

    Thanks Matt.
    Thank you,
    Lynne Hanson
    RL Hanson-Online

  9. #9
    Matt's Avatar
    Matt is offline GlowHost Administrator
    Join Date
    Jan 2005
    Location
    Behind your monitor
    Posts
    5,350

    Default

    If it were me I'd make it easy on myself and just use the password protect option from cPanel which will guarantee no one can get into the directory without a user/pass
    Send your friends and site visitors to GlowHost and get $125 plus bonus!
    GlowHost Affiliate Program | Read our Blog | GlowHost's Facebook | Follow us on Twitter | GlowHost on Google+

Similar Threads

  1. [How To] Redirect from HTTP to HTTPS using mod_rewrite
    By sergey in forum Knowledge Base
    Replies: 1
    Last Post: 05-13-2008, 01:21 PM
  2. Redirect Pages
    By QHF in forum General Support
    Replies: 11
    Last Post: 02-04-2008, 12:57 AM
  3. [How To] redirect a file to another url
    By Matt in forum Knowledge Base
    Replies: 2
    Last Post: 06-05-2007, 12:08 AM
  4. Newbie redirect questions
    By ski-mx kenny in forum General Support
    Replies: 3
    Last Post: 11-25-2005, 08:56 PM

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16