環境在OpenShift的Python 2.7/Bottle應用程序中放置robots.txt文件的位置?
- 的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
文件被放置在任何
wsgi
wsgi/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
應放置,使其送達正確。