Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-13-2012, 04:57 PM   PM User | #1
dan-dan
Regular Coder

 
dan-dan's Avatar
 
Join Date: Aug 2009
Location: England
Posts: 483
Thanks: 22
Thanked 79 Times in 78 Posts
dan-dan is on a distinguished road
Disallow folder indexing

I'm creating a site locally, though I want to test it live.

I don't have any hosting at the moment, though I'm able to host it on a friends site I created for her some time ago.

However, I don't want the folder and its contents to get indexed by any search engines.

I read that I can use the below rule within robots.txt
Code:
User-agent: *
Disallow: /
My question is, will this work being placed within a specific folder, or is it something that only works from root for the entire site.

If the later, is there a way to do it?

Thank you.
dan-dan is offline   Reply With Quote
Old 04-14-2012, 02:55 AM   PM User | #2
ShaneC
Codeasaurus Rex


 
Join Date: Jun 2008
Location: Redmond, WA
Posts: 659
Thanks: 31
Thanked 100 Times in 94 Posts
ShaneC is on a distinguished road
Some search engines will look for it in each directory, but not all. As such, in order for it to be effective, you need to put the file in the "root" directory (i.e: the top level directory, http://example.org/robots.txt).

Having said this, you can tell robots to simply not index your directory. So, instead of doing Disallow: /, which would tell search engines to not index the entire site, replace that with Disallow: /my_directory/ which will restrict no indexing to your directory (and sub-directories thereof).

For more information on this, check out this site.
__________________
Unless otherwise stated, any code posted is most likely untested and may contain syntax errors.
My posts, comments, code, and suggestions reflect only my personal views.
Web Portfolio and Code Snippets: http://shanechism.com
ShaneC is offline   Reply With Quote
Users who have thanked ShaneC for this post:
dan-dan (04-14-2012)
Old 04-14-2012, 12:17 PM   PM User | #3
dan-dan
Regular Coder

 
dan-dan's Avatar
 
Join Date: Aug 2009
Location: England
Posts: 483
Thanks: 22
Thanked 79 Times in 78 Posts
dan-dan is on a distinguished road
Thanks for the explanation and link ShaneC, much appreciated.
dan-dan is offline   Reply With Quote
Old 04-21-2012, 12:13 PM   PM User | #4
Whisper
New to the CF scene

 
Join Date: Apr 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Whisper is an unknown quantity at this point
does this .htaccess file go in the folder of the "Disallowed" listing or in the root of the site?
Whisper is offline   Reply With Quote
Old 04-21-2012, 05:19 PM   PM User | #5
MarkR
New Coder

 
Join Date: Sep 2011
Posts: 80
Thanks: 0
Thanked 13 Times in 12 Posts
MarkR is an unknown quantity at this point
I prefer to just use .htaccess and add a password to the directory.

That way search engines can't access it (some shady web crawlers ignore robots.txt rules) and it means people can't access it by accident.
__________________
Web Design Newcastle
MarkR is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:29 PM.


Advertisement
Log in to turn off these ads.