Results 1 to 8 of 8

Thread: redirect html coding?

  1. #1
    Senior Member
    freakee1's Avatar
    Join Date
    Jan 2008
    Location
    somewhere warmer
    Posts
    1,439
    Thanks
    227
    Thanked 768 Times in 405 Posts
    Rep Power
    429
    Reputation
    9214

    Default redirect html coding?

    Hello

    I have a friend who has a small website and is constantly bombarded by 1 specific ip address, he asked "is there a way of forwarding this specific ip address to another site?"

    I have seen there is bits n pieces out there for php and .htaccess redirect, but is there some html that can go on the index.html to direct someone with an ip address of 123.456.0.123 off to automatically when they come on to his site?


    He was saying that his hosting site he uses doesn't allow access to the .htaccess file



    thanks



    f
    有段者



Look Here ->
  • #2
    Senior Member
    Philquad's Avatar
    Join Date
    Jan 2008
    Location
    nelson bay
    Age
    55
    Posts
    3,872
    Thanks
    192
    Thanked 1,305 Times in 783 Posts
    Rep Power
    665
    Reputation
    16938

    Default

    he needs new hosting then

    i would swap the site to wordpress
    then block it
    wats the site, i will have a look for you
    https://www.facebook.com/philquad68

  • #3
    Senior Member cwispy's Avatar
    Join Date
    Jan 2008
    Location
    In bed sleeping
    Posts
    1,090
    Thanks
    140
    Thanked 296 Times in 114 Posts
    Rep Power
    265
    Reputation
    1581

    Default

    Quote Originally Posted by freakee1 View Post
    Hello

    I have a friend who has a small website and is constantly bombarded by 1 specific ip address, he asked "is there a way of forwarding this specific ip address to another site?"

    I have seen there is bits n pieces out there for php and .htaccess redirect, but is there some html that can go on the index.html to direct someone with an ip address of 123.456.0.123 off to automatically when they come on to his site?


    He was saying that his hosting site he uses doesn't allow access to the .htaccess file

    thanks

    f
    Assuming that the host supports php, rename the index.html file to index.php and then add something like this to the very beginning of the file.

    PHP Code:
    <?php

    if ($_SERVER['REMOTE_ADDR'] == "123.456.0.123") {
        
    header("Location: http://some.other.website");
        die;
    }

    ?>
    What would you do if your server was stolen or failed beyond repair?
    http://www.2000cn.com.au/shadowprotect.html

  • The Following User Says Thank You to cwispy For This Useful Post:

    freakee1 (08-11-12)

  • #4
    Junior Member
    Join Date
    Apr 2013
    Location
    Florida
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Reputation
    10

    Default

    Javascript

    <script language="javascript">
    window.location.href = "http://example.com"
    </script>

    Meta tag

    <meta http-equiv="refresh" content="0;url=http://example.com">

  • #5
    Banned

    Join Date
    Feb 2012
    Posts
    2,361
    Thanks
    166
    Thanked 1,205 Times in 607 Posts
    Rep Power
    0
    Reputation
    16611

    Default

    Quote Originally Posted by Duron View Post
    Javascript

    <script language="javascript">
    window.location.href = "http://example.com"
    </script>
    This JavaScript code snippet provided of course is bullshit. It redirects all visitors to "http://example.com".


    --------------------------


    @freakee1

    First of all you must know that JavaScript itself has no access to get the IP address and neither does anything running on the server.
    But if the web server where your site is hosted has SSI enabled (most Linux servers do), then there is a real chance to block not only an URL, but also an IP.

    Code:
    <script type="text/javascript">
    <!-- Hide script from old browsers<br>
    
    // if you know the referring URL, ex. "http://www.referringPageName.html"
    if(document.referrer = "http://www.referringPageName.html")  
    {
    	alert("Your URL has been banned from this site. Redirecting...");
    	window.location.replace("http://www.google.com"); 
    } 
    // if you know the referring IP address, ex. "23.23.23.23"
    else
    {
    	// define list of banned ips, each separated with a comma:
    	var bannedips=["23.23.23.23", "11.11.11.11"]
    	// this part gets the IP
    	var ip = '<!--#echo var="REMOTE_ADDR"-->';
    
    	var handleips=bannedips.join("|");
    	handleips=new RegExp(handleips, "i");
    
    	if (ip.search(handleips)!=-1)
    	{ 
    		alert("Your IP has been banned from this site. Redirecting...");
    		window.location.replace("http://www.google.com");
    	}
    }
    
    //-- Stop hiding script --> 
    </script>

  • The Following 3 Users Say Thank You to jwoegerbauer For This Useful Post:

    best4less (26-12-13),freakee1 (25-12-13),tristen (25-01-14)

  • #6
    Senior Member
    Philquad's Avatar
    Join Date
    Jan 2008
    Location
    nelson bay
    Age
    55
    Posts
    3,872
    Thanks
    192
    Thanked 1,305 Times in 783 Posts
    Rep Power
    665
    Reputation
    16938

    Default

    better late than never hey joey
    https://www.facebook.com/philquad68

  • #7
    Senior Member
    Chieflets's Avatar
    Join Date
    Jan 2008
    Posts
    1,408
    Thanks
    225
    Thanked 581 Times in 314 Posts
    Rep Power
    377
    Reputation
    6677

    Default

    Quote Originally Posted by freakee1 View Post
    Hello

    I have a friend who has a small website and is constantly bombarded by 1 specific ip address, he asked "is there a way of forwarding this specific ip address to another site?"

    I have seen there is bits n pieces out there for php and .htaccess redirect, but is there some html that can go on the index.html to direct someone with an ip address of 123.456.0.123 off to automatically when they come on to his site?


    He was saying that his hosting site he uses doesn't allow access to the .htaccess file



    thanks



    f

    If you are going to use php ..then use this

    PHP Code:
    <?php 
    $competitor 
    $_SERVER['REMOTE_ADDR']; 
    if (
    preg_match("/HISIPADRESS/",$competitor))//any IP you want to fool// 


    include (
    'fakepage.php'); 
     } else { 
    include (
    'realpage.php'); 


    ?>


    Put the above just after the opening body tag of the real page..

    Leave all the rest of the real page headers including titles, metas, etc just they are..

    make fakepage.php correspond to the body content for him..
    make realpage.php correspond to the body content for every one else..

    leave the body area blank apart from the scripts ..so

    PHP Code:
    <doctype> 
    <html> 
    <head>Real page header</head> 
    <body> 
    <?php 
    $competitor 
    $_SERVER['REMOTE_ADDR']; 
    if (
    preg_match("/HISIPADRESS/",$competitor))//any IP you want to fool// 


    include (
    'fakepage.php'); 
     } else { 
    include (
    'realpage.php'); 


    ?> 
    </body> 
    </html>
    also keep in mind This work..as long as he doesn't use proxies or his IP doesn't change.



    Chieflets
    Last edited by Chieflets; 26-12-13 at 03:24 PM.

  • The Following User Says Thank You to Chieflets For This Useful Post:

    tristen (25-01-14)

  • #8
    Junior Member azeemkhan's Avatar
    Join Date
    Apr 2014
    Location
    Pakistan
    Posts
    4
    Thanks
    0
    Thanked 1 Time in 1 Post
    Rep Power
    0
    Reputation
    20

    Default

    Your have to use 301 redirect go to the Google webmaster or open it's hosting plan and redirect it to your websites. Before one month my uncle site have same problems it was in Joomla and find out information and put into their roots and get solution. if you face any problems you can contact me via this forums.

  • 07-09-16, 08:21 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
    •