LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 10-09-2008, 06:11 PM   #1
steve51184
Member
 
Registered: Dec 2006
Posts: 381

Rep: Reputation: 30
php referrer script to block people not coming from my domain


hi there i need a php referrer script to block people not coming from my domain as i have a script that is password protected via .htaccess but people are giving the password out and i need a way to block people from visiting the script IF they didn't dome from my domain.com how do i do this?

also it doesn't have to be in php i'm more then happy to do it via .htaccess

Last edited by steve51184; 10-09-2008 at 06:12 PM.
 
Old 10-10-2008, 03:00 AM   #2
j-ray
Senior Member
 
Registered: Jan 2002
Location: germany
Distribution: ubuntu, mint, suse
Posts: 1,591

Rep: Reputation: 145Reputation: 145
you need sth like that in the httpd.conf

Deny from all
Allow from host.example.com

This link may be ehelpful anyway
http://httpd.apache.org/docs/2.0/howto/auth.html
 
Old 10-10-2008, 03:07 AM   #3
steve51184
Member
 
Registered: Dec 2006
Posts: 381

Original Poster
Rep: Reputation: 30
that will only allow my site to access my site (ie. Allow from mydomain.com) and not a user who came from a specified url so it's not what i'm after but thanks for trying

Last edited by steve51184; 10-10-2008 at 03:08 AM.
 
Old 10-10-2008, 03:29 AM   #4
j-ray
Senior Member
 
Registered: Jan 2002
Location: germany
Distribution: ubuntu, mint, suse
Posts: 1,591

Rep: Reputation: 145Reputation: 145
you can specify any url there and as many as you like.
The referrer is not always available in the user agent so not a reliable thing.
I guess you need some more personal authentication done by a scripting language...

Last edited by j-ray; 10-10-2008 at 03:32 AM.
 
Old 10-10-2008, 02:16 PM   #5
steve51184
Member
 
Registered: Dec 2006
Posts: 381

Original Poster
Rep: Reputation: 30
but that will only allow a predefined domain or ip address from accessing my site and that is not what i want.. i want people that CAME from my domain (ie visitors) to be able to access a certain script on my site

again thanks for the help but it's not what i'm after
 
Old 10-10-2008, 03:09 PM   #6
zeos
Member
 
Registered: Aug 2003
Posts: 150

Rep: Reputation: 15
Use mod_rewrite....

something along these lines of...(test it thoroughly yourself )


<Directory "/path/to/scriptdir">
Order Allow,Deny
Allow From All
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://www.mydomain.com [NC]
RewriteRule myscript.php - [L,F,NC]
</Directory>

Last edited by zeos; 10-12-2008 at 10:42 AM.
 
Old 10-11-2008, 10:30 AM   #7
steve51184
Member
 
Registered: Dec 2006
Posts: 381

Original Poster
Rep: Reputation: 30
PERFECT thank you
 
  


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
For people coming to another ..planet! rosspy Linux - Newbie 5 04-12-2008 03:43 AM
Blocking a domain referrer from a webserver? Seventh Linux - Security 1 02-06-2007 04:28 PM
LXer: Change Agents - people who will shape IT in the coming year LXer Syndicated Linux News 1 12-19-2005 10:12 PM
WinXP not coming on Samba domain villie Linux - Networking 0 04-09-2004 04:02 AM
Sendmail. Any way to block people from sending mail as me ForumKid Linux - Software 1 08-28-2003 12:32 PM

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

All times are GMT -5. The time now is 09:11 AM.

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