Results 1 to 5 of 5
  1. #1

    Question htaccess - Redirect all visitors except certain ip

    Did a search on the forum and google but could not find a solution for this reversed blocking

    I would like to redirect users who access the site from any IP address to be redirected like this:
    RedirectMatch /(.*)$ hxxp://

    and have anyone from an IP address of to just access/view the regular site, so not to be redirected.

    Any suggestions on how I can do this in my .htaccess file?

  2. #2
    Can you please more brief regarding redirection what you want to do...
    Back after a long time!

  3. #3
    Join Date
    Nov 2007
    Dallas, TX
    I'm assuming this is for an intranet / extranet setup?

    Might it be easier to just have an index.php that looks at the client IP and sends the appropriate content? You may not even have to redirect that way. If you want to go this PHP route, let me know, and I'll code a simple script for you (free).

    Mike G. - Limestone Networks - Account Specialist
    Cloud - Dedicated - Colocation - Premium Network - Passionate Support
    DDoS Protection Available - Reseller Program @LimestoneInc - 877.586.0555

  4. #4
    Thanks for your proposition/offer, but the whole site structure needs to be redirected including pdf's/video's and all different localization folders should have a their own redirection... and i think PHP is not an option with our current php backend....

    so actually i should be clearer... other example =)

    Redirect all users-->
    from --> to* -->** -->** -->*

    BUT users from should not be redirected

  5. #5
    Join Date
    Feb 2005
    This will probably need some tweaking but it should give you a start. Test the blocks one at a time.
    RewriteEngine On
    RewriteCond %{REMOTE_ADDR} !
    RewriteCond %{REQUEST_URI} ^/other/
    RewriteRule (.*)$1 [L]
    RewriteCond %{REMOTE_ADDR} !
    RewriteCond %{REQUEST_URI} ^/(.*)/
    RewriteRule (.*)$1 [L]
    Last edited by foobic; 02-25-2008 at 06:19 PM. Reason: reversed order of blocks

    "Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them." - Laurence J. Peter

Posting Permissions

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