Results 1 to 13 of 13
  1. #1

    Please help - trying to block specific sites from certain URLs

    I'd really like to block traffic to my site from certain other ones. I've been able to do it in the past by modifying the .htaccess file, but it only blocks people from visiting the main URL of my site - i.e., thisismysitesurlDOTcom.

    The problem is, I really need to block traffic from specific sites to certain entries in my journal - the URL is like this:

    thisismysitesurlDOTcom/journal/archives/0000.html (with the digits at the end just representing different journal entries.)

    I've tried everything I can, including different threads on this forum about how to redirect traffic, but none of it works - when I test the link to my site from the one I'm trying to block, it just goes exactly where its linked to. I can still only block people from going to my site's main URL.

    Can anyone help me with this? I'd really appreciate it.

    PS: I'm very, very sorry if this posts more than once. I keep having to go back and fix it because the forum won't let me post URLs yet.

  2. #2
    Join Date
    Oct 2002
    Location
    North America
    Posts
    1,229
    You'd have to put those entries into a separate directory, and then put an .htaccess file on that directory which blocked traffic from certain sites.
    Lesli Schauf, TLM Network
    Linux and Windows Hosting: Scribehost

  3. #3
    I tried blocking the sites in the .htaccess file in the "archives" directory, but it still didn't work. Is that the same as what you're saying?

    I'm not even sure what the right modifications to make in the .htaccess file are - I've tried everything I've found on different sites, and none of it has worked. If someone could tell me exactly what it is I should be putting in the .htaccess file was I'd really appreciate it.

    Sorry to be such a hassle.

  4. #4
    Join Date
    Oct 2002
    Location
    North America
    Posts
    1,229
    Not a problem. The explaination was a bit brief, at best.

    As to what you should be putting in the .htaccess file - someone else will need to help you with that.

    As to where...you'll need to create a separate directory for those entries you want to selectively block from traffic. Something like

    thisismysitesurlDOTcom/journal/archives/hidden/0000.html

    Then, you'd put most of your entries into the archives directory, with the "special" ones in the "hidden" directory. Then you'd put the specific .htaccess file into the "hidden" directory.

    You could also do:
    thisismysitesurlDOTcom/journal/archives/0000.html
    thisismysitesurlDOTcom/journal/hidden_archives/0000.html

    As to how you get the entries to publish in one archive location or another...that will depend on what blogging tool you're using, if you're using one.
    Lesli Schauf, TLM Network
    Linux and Windows Hosting: Scribehost

  5. #5
    Actually, I think my wording in the original post is at fault here - I'm being stupid because I'm frustrated and not thinking straight!

    I don't mind blocking access to my ENTIRE site from the ones I want to eliminate traffic from, but I can only seem to block it from the main URL - as in thisismysitesurlDOTcom. I don't want to block specific entries so much as I want to block EVERYTHING, but I have no idea why I didn't just phrase it that way in the first place. This is not my day, ha.

    Sorry for the confusion.

  6. #6
    Join Date
    Apr 2002
    Location
    Southern Maryland
    Posts
    246
    Ok, so you want to have the entire site blocked from people that don't have a user name/password?

    If so, you can do this in your hosting control panel. If you have cpanel you can use the Password Protect Directories. To do all of them, simply pick any of the directories on the list and back space the last /word/ so you can block the root.

    If not, I'm not really sure what you want to do. I'm confused.
    Sara

    Sara Nelson Photography Preserving your moments since 1973.

  7. #7
    I'm confused too.

    Basically I just want to block people visiting the ENTIRE site from one or two other sites that are currently linking to mine. That's all. I don't want to do username/password protection, just block people coming to the site from links that have been posted on a couple of forums.

    Thanks for the help. Sorry if I'm not being clear!

  8. #8
    Join Date
    Oct 2002
    Location
    North America
    Posts
    1,229
    Ah. Okay. Gotcha.

    Of course, now that I know what it is you want to do, I still can't help you with the specifics.

    Let me do a little research. I believe that it's possible, I just don't know the syntax off the top of my head.
    Lesli Schauf, TLM Network
    Linux and Windows Hosting: Scribehost

  9. #9
    Join Date
    Jun 2003
    Posts
    673
    http://www.spywareinfo.com/articles/referer_spam/ has a good explanation of how to use mod_rewrite to block access by HTTP_REFERER. If you put the .htaccess file at the top level of the site, it will block access to the subdirectories as well.

  10. #10
    Join Date
    Oct 2002
    Location
    North America
    Posts
    1,229
    Here's something to try:

    If you want to completely block folks and give them a "403 Forbidden" message, use this syntax:

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

    Just change the somedomain.com to the domains you want to block.

    Here's another link to some more information (a few of them):

    http://help.powweb.com/tutorials/htaccess/block.php

    http://www.webmasterworld.com/forum92/332.htm

    Edit to correct a typo in the example above.
    Lesli Schauf, TLM Network
    Linux and Windows Hosting: Scribehost

  11. #11
    Thanks for the continued support, everyone.

    I did what dan_erat said and went to the spywareinfo site. I edited the .htaccess but I still have the same problem - it blocks links to the main url of my site, but not any links to journal entries. Argh! I have no idea how to make it block EVERYTHING...

    If anyone has any ideas I'd appreciate hearing them!

    Lesli/living, I'd do the forbidden message method but my forbidden page has a link back to my site, which sort of defeats the purpose. Thanks for the help, though - I really appreciate it, really!

  12. #12
    Join Date
    Oct 2002
    Location
    North America
    Posts
    1,229
    Crisiszine, that Powweb link contains a way to route those people to a different URL entirely. You could send them off your site - or right back to the site where they came from.

    As to why the .htaccess prohibition won't work for subdirectories, it was my understanding that all subdirectories were governed by any .htaccess file rules in the directories above them. I don't know why it isn't working for you. That seems a bit odd.

    Just out of curiosity, why are you trying to block traffic from that one site? Bandwidth suckers? Or you don't want your content to be seen by people coming from that site?

    If it's the latter, then put your site behind a registration link and require registration for all readers - or take the content down. Publishing on the Internet is like shouting from a streetcorner. If you don't want everyone-and-I-mean-everyone to read it, don't publish it. I don't know of any way to totally block visitors from a specific URL short of the two solutions I suggest above.

    If it's the former, then route those visitors to a specially created page on your site that tells them that you're blocking all traffic from the URL from which they came, and DON'T include a link back to your site. You'll still get people who will go through the process of viewing the source, typing in the exact URL, et cetera, et cetera; but you will block the bandwidth thieves.
    Lesli Schauf, TLM Network
    Linux and Windows Hosting: Scribehost

  13. #13
    Lesli,

    Okay, I got the powweb thing to work and for some reason it doesn't show my custom 403 page anyway, so there's no link. Phew.

    Seriously, thanks a lot for the help and patience - I appreciate it. As for why I want to block traffic from a site in particular, I don't really want to get into a debate about the issue. Let's just say that I'd prefer if people didn't link to entries in my journal for the purposes of organizing harassment against me - and if they do, I don't think that I should have to take the entries down just to appease them.

    But anyway, thanks for the help and support, like I said.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •