Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 3 of 3

Thread: Redirect Traffic Based on IP

  1. #1
    ssgumby is offline Senior Member
    Join Date
    Feb 2009
    Posts
    683

    Default Redirect Traffic Based on IP

    Is there anyway to do a redirect of ALL traffic unless the request is from a certain IP? I want to eliminate the possibility of shoppers hitting my staging site so I want to redirect them to my live site but I want to hit my staging site myself if I come from my IP.

    I did this before with .htaccess on my PHP cart. All this came about because somehow my staging site got indexed. It slowly fell off index now but Im sure it still is around someplace.

  2. #2
    George the Great is offline Senior Member
    Join Date
    Nov 2006
    Location
    Cleveland, OH
    Posts
    1,792

    Default

    There are a few different ways that you can go about this depending on the final result you're looking for. If you want a reusable module that you can build, search for "restrict site access by ip address" (no quotes) in google and find the link on the first page of results to codeproject.com...it can be done in about 30 lines of code. You could also set up windows authentication on your staging site (instructions here in our manual) if you have direct access to the server.
    <a href="http://www.aspdotnetstorefront.com">Shopping Cart Software</a>

  3. #3
    ssgumby is offline Senior Member
    Join Date
    Feb 2009
    Posts
    683

    Default

    George,

    Just wanted to follow-up ... I used the sample from codeproject.com and it did exactly what I needed. Basically I have a list of IP's I want to access from, if the incoming IP is not in that list I then redirect to my live site.

    Works pretty slick, thanks for the tip!