2012-03-07 50 views
2

我剛剛將幾個靜態網站移至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" 

回答

0

這兩個網站似乎現在工作。也許只是需要一段時間才能傳播域名服務器更新。

+0

他們都在一直工作,只是一個人重定向到主頁,除非有www,而另一個則帶你到沒有www的正確的地方。 – Mica 2012-03-09 04:53:36

+0

對不起,我不明白這個問題。在SO上「碰撞」問題的典型方式是發佈賞金,或者讓你的問題得到滿足。我不知道你的問題的答案,但你有沒有檢查,看到DNS條目都完全一樣?工作案例中是否有額外的CNAME條目或其他重定向? – dragonx 2012-03-11 02:17:55

+0

您是否使用Google Apps域設置重定向?肯定會有一些可怕的事情發生,你會在carolyncaton.com上獲得不同的重定向(302)。我會嘗試使用Google Apps域設置,可能會刪除映射並將其添加回來。 – dragonx 2012-04-10 16:47:58

1

在Chrome中使用開發者控制檯(F12,點擊「保存日誌導航」按鈕),你可以看到http://carolyncaton.com/photos/得到302響應http://www.carolyncaton.com/。由於App Engine不支持裸(頂點)域,因此問題必須在其他位置。我建議你檢查FreeDNS的設置,如「保存路徑」。

+0

工作案例給出了301重定向到正確的文件(/ daw),失敗的案例給出了302重定向到基礎url(/)。我不確定您的A作業中是否有任何設置會影響此設置。 – dragonx 2012-04-10 16:27:18