PDA

View Full Version : Excluding a range of numbered files in Search


webfrog
05-06-2003, 06:15 PM
Hello,
It will be obvious I know enough about cgi/perl to get myself in trouble here...

I've set up a Search Engine feature for our website. It works great with one exception. I need it to exclude a range of files within a directory. I can't exclude the entire directory as there are other files within that directory that need to be indexed. Here's the code I'm working with:


# List of files, which should not be indexed
$no_index_files = 'robots.txt dir1/no_index.html leftnav_1_12345678.inc


My goal is to exclude any inc file beginning with "leftnav". I have a series of leftnav files name with the number configuration posted above (cid and pid numbers). (I "inherited" this site from our previous developer.)

Any advice? Thanks!
WebFrog

Mouldy_Goat
05-11-2003, 12:51 AM
If you want to do more of a 'wildcard' type method of excluding files from being indexed you probably need to change the actual bit of code which uses the $no_index variable.

As a quick fix... you could do something like:

@files = <leftnav*.inc>;
$no_index_files = 'robots.txt dir1/no_index.html leftnav_1_12345678.inc' . join ' ', @files;
That would get all the files in the current directory and add them to the list, I'm pretty sure. (Hasn't been tested).

If you post up the bit of code which does the magic stuff, I'm sure people could help you hack it around to work nicely :).