LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-15-2009, 09:15 PM   #1
mlapl1
LQ Newbie
 
Registered: Jun 2007
Posts: 16

Rep: Reputation: 0
Linking to a website only through another site


Hello

I have two websites: Website1 and Website2

I would like to prevent people from linking directly to Website2 by writing its URL in a browser. However, I would like them to have access to Website2 by clicking on a link in Website1. In other words, if the referrer is Website1 then access to Website2 is ok. Otherwise, I would like to block all other referrers, including people typing a URL directly into a browser.

I believe it is possible to control access through .htaccess. Would someone please point me to some code I could implement in .htaccess or somehow otherwise restrict access as indicated above?

BTW I have tried using deny and allow but that only seems to apply to addresses typed in the browser. I believe there is an answer which uses the rewrite engine but I have not been able to find the correct code anywhere.

Thank you very much.
Andrew
 
Old 05-16-2009, 09:01 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,770

Rep: Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587
You can use mod_rewrite to allow/deny access based on referrer. In your case you can use something like:
Code:
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://website1/special-link-page.html
RewriteRule (.*) - [F]
Regards
 
Old 05-16-2009, 09:27 AM   #3
mlapl1
LQ Newbie
 
Registered: Jun 2007
Posts: 16

Original Poster
Rep: Reputation: 0
Thank you. I appreciate it so much - it seems to work perfectly.

Andrew
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Want to block all website traffic for few IP but they will brows only 1 site aronnok Linux - Networking 1 05-22-2008 09:30 AM
Problem in using both load time linking and runtime linking durgaprasad_j Linux - General 0 08-01-2006 03:49 AM
Protecting the content of your website from remote/direct linking Basel Programming 4 01-26-2006 09:35 PM
localhost:901 gets redirected to "Power Linking" web site advertisement condosolon Linux - Newbie 2 03-04-2004 12:23 PM
how to protect images linking from other website adrianmak Linux - Software 9 10-19-2003 07:43 AM


All times are GMT -5. The time now is 12:31 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration