scriptygoddess

18 Feb, 2003

More htaccess tricks – blocking links to your page

Posted by: Jennifer In: Bookmarks

There's already a few posts on here about htaccess – but here's one more.
Blocking linking URLs

Essentially the link above says this:

SetEnvIfNoCase Referer "^http://www.google.com/" BadReferrer
order deny,allow
deny from env=BadReferrer

That will forward anyone linking to your site to a 403 access denied error page.

RewriteEngine On
RewriteCond %{HTTP_REFERER} ^http://www.google.com/
RewriteRule /* http://www.yoursite.com/restricted_url.html [R,L]

That will forward anyone linking to your site to the http://www.yoursite.com/restricted_url.html page.

14 Responses to "More htaccess tricks – blocking links to your page"

1 | Jacob

February 19th, 2003 at 6:07 am

Avatar

Whats the point? Surely they can just type the URL in?

2 | Jennifer

February 19th, 2003 at 7:17 am

Avatar

I guess it's one extra step, and you'd be surprised how lazy people can be. They'd have to *know why* they're getting redirected (or that they even WERE redirected) and/or blocked this way. It has the same effect as the google blocker. Most people will click the link see the error and move on. If someone has a burning desire to get to your site, then they will… but I blocked ALL google traffic to my site with a similar block like this… so… the point is: lazy people will move on and 99.9% of people are lazy. 😉

3 | Jennifer

February 19th, 2003 at 7:19 am

Avatar

One side note (since this was a source of confusion for a few people) – when I say "my" site – I mean my personal journal/blog – NOT scriptygoddess.

4 | Mad Bull

February 19th, 2003 at 3:43 pm

Avatar

I wonder if I'm missing something. I thought that people usually wanted people to come to their site and that people linking to your site was a good thing.
Why wouldn't you want people to link to your site?
I have another question… Seeing what you have done here with the htaccess file, I wonder if it can be used to do something else I want to do…
I went to a site which had some pictures I wanted, so I right clicked on the picture, but I got a message… The guy had used a javascript to disable right click functionality.
I right clicked on the web page to look at the source to get the name of the .jpeg file. I used that name and pathing info and typed the URL into the address combo box in IE, but got directed to an error message page. Further, I clicked on "file/save as" to try to download the webpage and images, but what was downloaded was the error message pages. By this time I had lost interest in the picture. What I want to know is how to block people from downloading imgs like that. When they try, send them another HTML page instead. Do you think the htaccess file can be used to do that?

5 | Mad Bull

February 19th, 2003 at 3:48 pm

Avatar

Ignore my foirst point above… I hadn't followed your link. My second question still stands tho…

6 | Joshua Ferguson

February 19th, 2003 at 5:57 pm

Avatar

I'd be very interested to know this as well as I'm not to keen on people ripping pics off of my photoblog.

7 | Mariann

February 27th, 2003 at 12:46 pm

Avatar

Wonderful… I was looking for this kind of tip, especially today when two referrals came by my blog because of a nasty post by a former friend. This is ideal because now I can redirect them elsewhere for good… thanks so much!

8 | Kacy

March 2nd, 2003 at 10:50 pm

Avatar

I've been looking for a way to block search engine referrals… Thanks!

I used the ReWrite to redirect any referrals from google straight back to google. Does anyone have an idea how to use the ReWrite to redirect hits from more than referrer? I can't figure out how to get this to work or I have the syntax wrong.

9 | nins

May 2nd, 2003 at 8:27 am

Avatar

hello.
i really need some help.
i've uploaded a .htaccess file into my ftp account through WS-FTP95.
as the norm, it's now invisible.
problem is, i wish to delete it now, so how
am i able to view it and do that?

10 | Jennifer

May 2nd, 2003 at 9:09 am

Avatar

it's there, but your ftp program probably doesn't show you files that start with a . so two things – look around in the preferences to see if you can change that – also – if you want to blow it away completely – just upload a blank file named the same (.htaccess)

If you can't find a setting in your ftp program that will let you see . files – does your host provider have another means for you to browse files? (ie. mine has something in the control panel. My brain still hasn't had enough coffee yet, so I'm draing a blank on the name – but it's probably something simple like "file manager"… hmm…that could be it…

In any case – uploading the blank .htaccess will overwrite the one you got on there…

11 | nins

May 3rd, 2003 at 3:17 am

Avatar

thing is i'm kinda experimenting with this stuff, so PLS bear with me.
i've uploaded a .htaccess file to my ftp account.
trying to deny myself to see if it really works.
but nothing happened. i wasn't blocked or anything.
my host says that they support .htaccess files.
so can you tell me where i went wrong?
thx :)

12 | nins

May 3rd, 2003 at 3:28 am

Avatar

here's the code that i've uploaded into the same directory where all my other documents are.
in this post, i've replaced the IP numbers with Xs instead.

order allow,deny
allow from all
deny from xxx.x.xxx.xx
deny from xxx.x.xxx.xx
deny from xxx.x.xxx.xx
ErrorDocument 403 /pageone.html

order allow,deny
deny from all

13 | Carl

September 25th, 2003 at 11:38 pm

Avatar

How can I get this direct to an index.mhtml or some
other mhtml page?

# -FrontPage-

IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

&#60Limit GET POST&#62
order deny,allow
deny from all
allow from all
&#60/Limit&#62
&#60Limit POST PUT DELETE&#62
order deny,allow
deny from all
&#60/Limit&#62
AuthName http://www.steuartsworld.com
AuthUserFile /www/htdocs/domains/s6/01011/www.steuartsworld.com/webdocs/_vti_pvt/service.pwd
AuthGroupFile /www/htdocs/domains/s6/01011/www.steuartsworld.com/webdocs/_vti_pvt/service.grp

14 | Andy Held

November 11th, 2004 at 6:50 pm

Avatar

Great! thanks a lot! i had the problem, google is indexing only the iframe html so users from google only see the iframe page not the complete page with main frame. now i can redirect them to the right webpage.

Featured Sponsors

Genesis Framework for WordPress

Advertise Here


  • Scott: Just moved changed the site URL as WP's installed in a subfolder. Cookie clearance worked for me. Thanks!
  • Stephen Lareau: Hi great blog thanks. Just thought I would add that it helps to put target = like this:1-800-555-1212 and
  • Cord Blomquist: Jennifer, you may want to check out tp2wp.com, a new service my company just launched that converts TypePad and Movable Type export files into WordPre

About


Advertisements