Cable Forum

Cable Forum (https://www.cableforum.uk/board/index.php)
-   Internet Discussion (https://www.cableforum.uk/board/forumdisplay.php?f=25)
-   -   Website Help (Advance) (https://www.cableforum.uk/board/showthread.php?t=15792)

JediMaster 04-08-2004 18:34

Website Help (Advance)
 
I am in need of a STRANGE request :p:

If a website (say www.url1.com ) links to a page, say help.htm (www.url1.com/help.htm) how can I get a script, code or HTACCES to allow this example...

www.url1.com/help.htm shows a Page.... But if any other site (say www.url2.com) links to www.url1.com/help.htm another page Displays... (Maybe like a "No Hotlinking or Custom NO Page Found)

I dont want a Error 404 thing in HTACCES, but a way to moniter where a link came from & display either the first Page or Second... But both have the same HTML address (www.url1.com/help.htm) & both editable HTML's

TIA..:dunce:

Bifta 04-08-2004 18:37

Re: Website Help (Advance)
 
http://www.alistapart.com/articles/hotlinking/

JediMaster 05-08-2004 14:03

Re: Website Help (Advance)
 
Quote:

Originally Posted by Bifta

Thanks for that Bifta..

But I think that is for JPG or GIFS only ...... I wanted one that would work on HTML's or PHP

Same idea as Image Hotlinking, but if anyone typed the URL in the Address bar or click on a link "Out Side" my site, then it will display another page. But if the link came from my chosen website URL it would allow..

Any Ideas guys?

Bifta 05-08-2004 14:06

Re: Website Help (Advance)
 
you could set up a php script (or ASP, even javascript) to read the document referrer and redirect them to a different page it the referrer doesn't contain your domain name.

Bifta 05-08-2004 14:33

Re: Website Help (Advance)
 
You can try this in each of your documents.

Code:

<script language="javascript">
if {document.referrer.indexOf("website.com") == -1}
window.location = "http://redirecturlinhere";
</script>


greencreeper 05-08-2004 15:52

Re: Website Help (Advance)
 
Correct way is to use mod_rewrite to check the referrer and redirect to your site's main page if the referrer is not your site. The guide for Apache 2 is here:

http://httpd.apache.org/docs-2.0/misc/rewriteguide.html

I don't think mod_rewrite is part of the default build though.

JediMaster 05-08-2004 16:12

Re: Website Help (Advance)
 
Quote:

Originally Posted by greencreeper
Correct way is to use mod_rewrite to check the referrer and redirect to your site's main page if the referrer is not your site. The guide for Apache 2 is here:

http://httpd.apache.org/docs-2.0/misc/rewriteguide.html

I don't think mod_rewrite is part of the default build though.

:Yikes: My Brain HURTS LOL

So much info...

Can you post what I need to type ? & where to stick it (No NOT that PLACE :mad: )

If Referal comes from www.suzip.co.uk ALLOW to URL1.com if NOT off www.suzip.co.uk send to url2.com

Thanks

Bifta 05-08-2004 16:14

Re: Website Help (Advance)
 
Code:

<script language="javascript">
if {document.referrer.indexOf("suzip.co.uk") == -1}
window.location = "url2.com";
</script>

Stick it in your <head> tags.

Bifta 05-08-2004 16:38

Re: Website Help (Advance)
 
However .. i've just retested it and it doesn't work :( I'll find something a bit more useful. The trouble is you need to strip out everything after the the final / for the referrer so it's not the most elegant bit of code.

Try putting this in your .htaccess file

RewriteEngine On RewriteCond %{HTTP_REFERER} !.*suzip.co.uk.* [NC]
RewriteCond %{HTTP_REFERER} !.*suzip.co.uk.* [NC]
RewriteRule /* http://whereveryouwanttoredirectpeopleto.com/ [R,L]

greencreeper 05-08-2004 17:42

Re: Website Help (Advance)
 
Quote:

Originally Posted by JediMaster
:Yikes: My Brain HURTS LOL

So much info...

Can you post what I need to type ? & where to stick it (No NOT that PLACE :mad: )

If Referal comes from www.suzip.co.uk ALLOW to URL1.com if NOT off www.suzip.co.uk send to url2.com

:D

It is a very powerful, and hence complex, piece of software, plus it makes heavy use of regular expressions, which is a language in itself.

Bifta's post looks about right. Like I said in my PM, my encounters with rewrite rules have been few and traumatic :) I tend to look for similar examples and build the rules from them, testing as I go.

You might have to escape the . in the URL's - \.


All times are GMT. The time now is 23:41.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
All Posts and Content are © Cable Forum