LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-10-2008, 08:37 PM   #1
steve51184
Member
 
Registered: Dec 2006
Posts: 381

Rep: Reputation: 30
block access to a site from all but one ip address


how can i block access to a site (or rather a folder on my site) from all but one ip address AND have them sent to another site/html file on my server

i also want to do this via .htaccess?

so far i have this but it doesn't work as rather then people getting sent to another page they get an "Internal Server Error" message

Code:
ErrorDocument 403 http://domain.com/some-page-you-want-them-to-get-sent-to.html
Order deny,allow
Deny from all
Allow from my-ip-here
so for example if someone goes to mydomain.com/myfolder i want everyone but me to be sent to mydomain.com/somefolder/

Last edited by steve51184; 12-10-2008 at 08:40 PM.
 
Old 12-10-2008, 09:10 PM   #2
jhwilliams
Senior Member
 
Registered: Apr 2007
Location: Portland, OR
Distribution: Debian, Android, LFS
Posts: 1,168

Rep: Reputation: 211Reputation: 211Reputation: 211
This is sort of some mangled pseudo code but might help stear you in a functional direction :-) I adapted it from a spammer redirect clause in my main .htaccess:

Code:
# set the okay variable
SetEnvIfNoCase %{REMOTE_HOST} MYREMOTEHOST okay=1
RewriteCond okay not equal to 1
RewriteRule ^(.*) /some-file.html [R=301,L]

Last edited by jhwilliams; 12-10-2008 at 09:12 PM.
 
Old 12-10-2008, 09:14 PM   #3
steve51184
Member
 
Registered: Dec 2006
Posts: 381

Original Poster
Rep: Reputation: 30
not really sure what that does but i don't think it's what i'm after.. can you explain what it does please
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
by using iptables block mac address to restric user to access internet Farrukh Fida Linux - Networking 3 10-09-2006 07:59 AM
how do you block access to a site? smarthouseguy Slackware 3 05-14-2006 10:09 AM
can access site address but not hostip: dag apt tomhemba Linux - Networking 2 06-17-2004 09:01 PM
Block access by ip address on Smoothwall. chrisknight Linux - Software 6 09-21-2003 08:57 AM
block local user to access a site xen_chris Linux - Newbie 3 04-15-2003 09:55 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 05:03 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration