我剛剛將幾個靜態網站移至Google的App Engine,如果您想使用自己的域名,則需要使用www子域名。這兩個域的路由都是正確的,除了一個完整的url路徑不會傳遞給子域,除非在鏈接中輸入了www或者存在於該域中;沒有www,頁面重定向回家。Google App Engine網址路徑與www子域名丟失
工作站點或者鏈接將工作:
http://www.synth.tk/daw/
http://synth.tk/daw/
問題的站點只有第一個鏈接將工作;第二重定向到主頁:
http://www.carolyncaton.com/photos/
http://carolyncaton.com/photos/
兩個域設置爲使用以下的主機記錄按谷歌的指示FreeDNS:
@ | A | 216.239.32.21
@ | A | 216.239.34.21
@ | A | 216.239.36.21
@ | A | 216.239.38.21
www | CNAME | ghs.google.com
無一不是使用以下app.yaml
文件:
application: app-name-here
version: 1
runtime: python
api_version: 1
default_expiration: "30d"
handlers:
- url: /(.*\.css)
mime_type: text/css
static_files: static/\1
upload: static/(.*\.css)
- url: /(.*\.html)
mime_type: text/html
static_files: static/\1
upload: static/(.*\.html)
expiration: "1h"
- url: /(.*\.js)
mime_type: text/javascript
static_files: static/\1
upload: static/(.*\.js)
- url: /(.*\.eot)
mime_type: application/vnd.ms-fontobject
static_files: static/\1
upload: static/(.*\.eot)
- url: /(.*\.(svg|svgz))
mime_type: images/svg+xml
static_files: static/\1
upload: static/(.*\.(svg|svgz))
- url: /(.*\.ttf)
mime_type: font/truetype
static_files: static/\1
upload: static/(.*\.ttf)
- url: /(.*\.woff)
mime_type: application/x-font-woff
static_files: static/\1
upload: static/(.*\.woff)
- url: /(.*\.pdf)
mime_type: application/pdf
static_files: static/\1
upload: static/(.*\.pdf)
# image files
- url: /(.*\.(bmp|gif|ico|jpeg|jpg|png))
static_files: static/\1
upload: static/(.*\.(bmp|gif|ico|jpeg|jpg|png))
# index files
- url: /(.+)/
static_files: static/\1/index.html
upload: static/(.+)/index.html
expiration: "15m"
- url: /(.+)
static_files: static/\1/index.html
upload: static/(.+)/index.html
expiration: "15m"
# site root
- url:/
static_files: static/index.html
upload: static/index.html
expiration: "15m"
我在想也許你沒有完全閱讀我的文章。再看一次。問題是,爲什麼一個人正確地轉發到www,而另一個未能通過完整的url路徑。 – Mica 2012-03-07 16:01:13