dryving
dryving

Reputation: 77

directories with no index file

I have a site that allows download or streaming of mp3 files. All the mp3 files are located in a sub-directory called "mp3". An error I'm getting from google (and something I'd like to avoid) is that when the directory itself is called in a browser like this

http://www.mysite.com/mp3/

it brings up the usual (and correct) error that the directory contains no index file. I know how to make a php file that redirects the user to whatever page I want, and I know that I could make an index.html file that is 301 redirected to whatever page I need, but is there a better way to handle this that is better for google? I could mark the directory as forbidden in the robots.txt file, but is there a better way to handle this that also looks more professional to the end user?

Upvotes: 1

Views: 1166

Answers (3)

drew010
drew010

Reputation: 69967

Adding Options -Indexes to the .htaccess file in that directory is quite common.

The end result is that the user sees a 403 Forbidden error. I'm not sure if this is what you mean by

it brings up the usual (and correct) error that the directory contains no index file.

This practice is quite common, even on very large sites. It doesn't prevent any users or Google from finding or downloading the actual MP3 files. Google won't penalize you for the 403 error. And if you tell it not to index /mp3/* then it shouldn't even hit that directory to begin with.

Upvotes: 1

colonelclick
colonelclick

Reputation: 2215

I prefer to handle these cases with a .htaccess file, sending a 301 error, and directing to another page that exists. Based on my research this is the most search engine friendly.

Upvotes: 1

Deleteman
Deleteman

Reputation: 8700

Your site should not have links to that folder without specifying a filename, so the user should not reach that destination. If they manually input that URL I would suggest using custom pages for the 404 or 403 errors (not found or forbidden). I would consider that profesional enough,

And for google, I would go with the robots.txt option.

Upvotes: 2

Related Questions