没有索引文件目录 [英] directories with no index file

查看:198
本文介绍了没有索引文件目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网站,让下载的MP3文件或流。所有的MP3文件位于的子目录中称为MP3。一个错误我是从谷歌(和一些我想避免的方法)是,当目录本身被称为在这样的浏览器

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/

它带来了一般的(正确的)错误的目录中没有索引文件。我知道如何使用户重定向到任何网页我想一个PHP文件,我知道我可以做的是301重定向到任何网页,我需要一个index.html文件,但有没有更好的方式来处理这一点,对于谷歌更好?我可以标记为禁止在robots.txt文件的目录,但有一个更好的方式来处理这一点,看起来也更专业最终用户?

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?

推荐答案

您的网站不应该有链接到该文件夹​​时没有指定文件名,所以用户不能达到该目标。如果手动输入该网址我会建议使用自定义页面为404或403错误(未找到或禁止)。我会认为设备专业不够,

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,

而对于谷歌,我会用robots.txt的选项去了。

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

这篇关于没有索引文件目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆