【发布时间】:2014-07-19 17:59:57
【问题描述】:
环境
- Python 2.7
- OpenShift
应用结构:
.git
.openshift
data
libs
wsgi
- static
- views
- application
- my_bottle_app.py
README.md
setup.py
setup.pyc
setup.pyo
期望的行为
我想为该位置的文件创建robots.txt 规则:
wsgi/static/file_1.txt
wsgi/static/file_2.txt
例如:
User-agent: *
Disallow: /file_1.txt
Disallow: /file_2.txt
问题
robots.txt 文件是否应该放在其中一个
wsgiwsgi/static- 还是应用程序结构的“根”?
编辑:
为了澄清,该应用程序是一个Bottle 应用程序,因此有许多路由服务于不同的内容。
此外,所有页面都通过 https 提供自定义功能:
def redirect_http_to_https(callback):
'''Bottle plugin that redirects all http requests to https'''
def wrapper(*args, **kwargs):
scheme = request.urlparts[0]
if scheme == 'http':
# request is http; redirect to https
redirect(request.url.replace('http', 'https', 1))
else:
# request is already https; okay to proceed
return callback(*args, **kwargs)
return wrapper
install(redirect_http_to_https)
所以我试图了解robots.txt 应该放在哪里,以便正确提供服务。
【问题讨论】:
标签: python-2.7 openshift robots.txt bottle