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.

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

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

1 | 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

2 | 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*

<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit POST PUT DELETE>
order deny,allow
deny from all
</Limit>
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

3 | 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 :)

4 | 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…

5 | 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?

6 | 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.

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 | 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…

9 | 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.

10 | 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?

11 | 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.

12 | Jacob

February 19th, 2003 at 6:07 am

Avatar

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

13 | 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. ;-)

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


  • Curt: If anyone comes across this with similar issues I was able to sort out the pagination issues painlessly with easyCommentsPaginate from http://www.mush
  • Christopher: Yeah, it is indeed hard to do. And something remains elusive about why the pagination never worked. I tried everything I could find. Regardless, I
  • Jennifer: Hi Christopher, always hard to bug test stuff like that remotely. Sorry those didn't help. Glad you found a solution though :)

About


Advertisements