View Full Version : Search in specific directory ONLY?

01-19-2004, 02:05 AM
Below in this forum is a good thread (and solution) on doing sub-directory specific searches. I have a slightly different problem. I have an an index of a site:


There's a protected area,


I need to have a search tool for the main intranet that indexes everything - EXCEPT the subdirectory (it's important that stuff stay away from prying eyes).

At the same time, I want to have a search for the subdirectory that searches ONLY that subdirectory.

I can see how to do the latter, but not the former. Any suggestions? Many thanks in advance.

Michael Fuchs

01-19-2004, 05:07 AM

The solution is in this thread (http://www.phpdig.net/showthread.php?s=&threadid=363).


01-19-2004, 05:40 AM
Thanks very much. That's actually the thread to which I was referring. However, unless I'm mistaken, it only describes how to limit a search to a given directory; not how to exclude a directory from a given search. To rephrase my problem:

I need the main search engine to return results from everything under:


EXCEPT for materials in


At the same time, I do need to do what that thread describes - which is have a separate search for ONLY


That means that those materials have to be in the index. So how do I keep them out of searches for the primary search of the main site? The problem seems to be that phpdig bases it's notion of what's a "site" or "index" based on hostname. I essentially need two separate and exclusive sites, or indexes, for two areas that happent to be on the same host. Any workaround ideas? Many thanks again.


01-19-2004, 06:31 AM
Hi. If PhpDig has already crawled myintranet/restricted you can delete the restricted directory from the admin panel and then use a robots.txt file. You can also delete and exclude the restricted directory from the admin panel and forego the robots.txt file. To delete and/or exclude the directory, go to the admin panel, click the site, click the update button, and then click a red X or red circle symbol.

01-19-2004, 08:04 AM
Thanks very much. But then how do I provide a search function for that directory (if it's been excluded from the index)? I will recap again. 8^)

One search for everything in

http://myintranet/ - EXCEPT http://myintranet/restricted/

Another search for

http://myintranet/restricted/ ONLY.

I understand how to do either (instructions for each have been thoughtfully provided ;^). But I don't see any way to do both at once - in order to keep the restricted area out of the main search, I have to delete or restrict it, which means there's no way to search it separately (that I can see).

Many thanks again. - Michael

01-22-2004, 01:22 PM
Hi. If you want two separate searches, then you'd need to install PhpDig twice, once for http://myintranet/ and then again for http://myintranet/restricted/ as there is no way to currently allow the options you seek. Alternatively, you could protect http://myintranet/restricted/ with a .htaccess file and crawl, so if users click a restricted page, they are asked to login, but this will not prevent the results from showing in a search.

01-22-2004, 11:06 PM
That's what I was afraid of, thanks for clearing it up.

Perhaps I'll take this to the mod_requests forum . . .