The following handlers will navigate to pages according to your requirements

- url: /
  static_files: www/index.html
  upload: www/index.html


- url: /folderA/(.*)
  static_files: folderA/index.html
  upload: folderA/index.html
  
- url: /folderB/(.*)
  static_files: folderB/index.html
  upload: folderB/index.html
  
- url: /folderA
  static_files: folderA/index.html
  upload: folderA/index.html
  
- url: /folderB
  static_files: folderB/index.html
  upload: folderB/index.html
  
- url: /(.*)
  static_files: www/index.html
  upload: www/index.html


This configuration will navigate to www if nothing is typed, and to folderA 
or folderB irrelevant of what is after the slash by using (.*), which means 
any string of characters is accepted. 

I also added folderA and folderB with no slashes in case the user did not 
specify any pages. And lastly /(.*) to catch all other urls that do not 
match the previous handlers.


On Thursday, July 5, 2018 at 12:49:09 PM UTC-4, Koki wrote:
>
> Dan! Thank you for your reply!
> After your suggestion, I changed my app.yaml to this:
> runtime: python27
> api_version: 1
> threadsafe: true
>
> default_expiration: "3m"
>
> handlers:
> - url: /(.*\.(appcache|manifest))
>   mime_type: text/cache-manifest
>   static_files: static/\1
>   upload: static/(.*\.(appcache|manifest))
>
> - url: /(.*\.atom)
>   mime_type: application/atom+xml
>   static_files: static/\1
>   upload: static/(.*\.atom)
>
> - url: /(.*\.crx)
>   mime_type: application/x-chrome-extension
>   static_files: static/\1
>   upload: static/(.*\.crx)
>
> - url: /(.*\.css)
>   mime_type: text/css
>   static_files: static/\1
>   upload: static/(.*\.css)
>
> - url: /(.*\.eot)
>   mime_type: application/vnd.ms-fontobject
>   static_files: static/\1
>   upload: static/(.*\.eot)
>
> - url: /(.*\.htc)
>   mime_type: text/x-component
>   static_files: static/\1
>   upload: static/(.*\.htc)
>
> - url: /(.*\.html)
>   mime_type: text/html
>   static_files: static/\1
>   upload: static/(.*\.html)
>
> - url: /(.*\.ico)
>   mime_type: image/x-icon
>   static_files: static/\1
>   upload: static/(.*\.ico)
>
> - url: /(.*\.js)
>   mime_type: text/javascript
>   static_files: static/\1
>   upload: static/(.*\.js)
>
> - url: /(.*\.json)
>   mime_type: application/json
>   static_files: static/\1
>   upload: static/(.*\.json)
>
> - url: /(.*\.m4v)
>   mime_type: video/m4v
>   static_files: static/\1
>   upload: static/(.*\.m4v)
>
> - url: /(.*\.mp4)
>   mime_type: video/mp4
>   static_files: static/\1
>   upload: static/(.*\.mp4)
>
> - url: /(.*\.(ogg|oga))
>   mime_type: audio/ogg
>   static_files: static/\1
>   upload: static/(.*\.(ogg|oga))
>
> - url: /(.*\.ogv)
>   mime_type: video/ogg
>   static_files: static/\1
>   upload: static/(.*\.ogv)
>
> - url: /(.*\.otf)
>   mime_type: font/opentype
>   static_files: static/\1
>   upload: static/(.*\.otf)
>
> - url: /(.*\.rss)
>   mime_type: application/rss+xml
>   static_files: static/\1
>   upload: static/(.*\.rss)
>
> - url: /(.*\.safariextz)
>   mime_type: application/octet-stream
>   static_files: static/\1
>   upload: static/(.*\.safariextz)
>
> - url: /(.*\.(svg|svgz))
>   mime_type: images/svg+xml
>   static_files: static/\1
>   upload: static/(.*\.(svg|svgz))
>
> - url: /(.*\.swf)
>   mime_type: application/x-shockwave-flash
>   static_files: static/\1
>   upload: static/(.*\.swf)
>
> - url: /(.*\.ttf)
>   mime_type: font/truetype
>   static_files: static/\1
>   upload: static/(.*\.ttf)
>
> - url: /(.*\.txt)
>   mime_type: text/plain
>   static_files: static/\1
>   upload: static/(.*\.txt)
>
> - url: /(.*\.unity3d)
>   mime_type: application/vnd.unity
>   static_files: static/\1
>   upload: static/(.*\.unity3d)
>
> - url: /(.*\.webm)
>   mime_type: video/webm
>   static_files: static/\1
>   upload: static/(.*\.webm)
>
> - url: /(.*\.webp)
>   mime_type: image/webp
>   static_files: static/\1
>   upload: static/(.*\.webp)
>
> - url: /(.*\.woff)
>   mime_type: application/x-font-woff
>   static_files: static/\1
>   upload: static/(.*\.woff)
>
> - url: /(.*\.xml)
>   mime_type: application/xml
>   static_files: static/\1
>   upload: static/(.*\.xml)
>
> - url: /(.*\.xpi)
>   mime_type: application/x-xpinstall
>   static_files: static/\1
>   upload: static/(.*\.xpi)
>
> # image files
> - url: /(.*\.(bmp|gif|ico|jpeg|jpg|png))
>   static_files: static/\1
>   upload: static/(.*\.(bmp|gif|ico|jpeg|jpg|png))
>
> # audio files
> - url: /(.*\.(mid|midi|mp3|wav))
>   static_files: static/\1
>   upload: static/(.*\.(mid|midi|mp3|wav))  
>
> # windows files
> - url: /(.*\.(doc|exe|ppt|rtf|xls))
>   static_files: static/\1
>   upload: static/(.*\.(doc|exe|ppt|rtf|xls))
>
> # compressed files
> - url: /(.*\.(bz2|gz|rar|tar|tgz|zip))
>   static_files: static/\1
>   upload: static/(.*\.(bz2|gz|rar|tar|tgz|zip))
>
> # index files
> - url: /(.*)
>   static_files: static/index.html
>   upload: static/index.html
>
> # site root
> - url: /
>   static_files: static/index.html
>   upload: static/index.html
>
> It works perfectly for
> https://koki-6hats.appspot.com/index.html
> https://koki-6hats.appspot.com/index 
> <https://koki-6hats.appspot.com/index.html>
> https://koki-6hats.appspot.com/ 
> <https://koki-6hats.appspot.com/index.html>
>
> even... https://koki-6hats.appspot.com/ 
> <https://koki-6hats.appspot.com/index.html>anything
>
> But, when the url is https://koki-6hats.appspot.com/ 
> <https://koki-6hats.appspot.com/index.html>anything/[withonemorelevel], 
> it seems still can link to index.html, but all css, js, etc are broken.
>
> Do you have any idea to fix?
>
> Dan S (Cloud Platform Support)於 2018年7月5日星期四 UTC+8下午11時34分23秒寫道:
>>
>> As per [1] the app.yaml should be like this:
>>
>> runtime: python27
>> api_version: 1
>> threadsafe: true
>>
>> handlers:
>> - url: /
>>   static_files: www/index.html
>>   upload: www/index.html
>>
>> - url: /(.*)
>>   static_files: www/\1
>>   upload: www/(.*)
>>
>> Moreover, it is important to keep the folder hierarchy as recommended in 
>> the documentation, all folders below the 'www' folder.
>>
>> [1] 
>> https://cloud.google.com/appengine/docs/standard/python/getting-started/hosting-a-static-website
>>
>> On Thu, Jul 5, 2018 at 11:10 AM Parth Mishra <[email protected]> wrote:
>>
>>> What handlers have you specified? 
>>>
>>> On Thursday, July 5, 2018 at 9:01:53 AM UTC-4, Koki wrote:
>>>>
>>>> I have deploy my website through the tutorials using Google App Engine.
>>>>
>>>> My website is work now. 
>>>>
>>>> However, it's only works on https://koki-6hats.appspot.com/index.html
>>>>
>>>>
>>>> For other cases like:
>>>>
>>>> https://koki-6hats.appspot.com/index
>>>>
>>>> https://koki-6hats.appspot.com/
>>>>
>>>> https://koki-6hats.appspot.com/shouldGoToIndex.html
>>>>
>>>> is not worked. 
>>>>
>>>>
>>>> How can I config the routing rule to make sure all links above can 
>>>> redirect to index.html automatically?
>>>>
>>>>
>>>> My app.yaml: 
>>>>
>>>> env: flex
>>>>
>>>> runtime: php
>>>>
>>>> runtime_config:
>>>>
>>>>   document_root: .
>>>>
>>>>
>>>> I found that there are some method using standard environment to do the 
>>>> static redirection. But when I tried to use that approach, my index.html 
>>>> breaks and remain black text and white background only.
>>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Google App Engine" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected].
>>> To post to this group, send email to [email protected].
>>> Visit this group at https://groups.google.com/group/google-appengine.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/google-appengine/f4928cd5-0b92-4bf8-ae7b-1508200b34cd%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/google-appengine/f4928cd5-0b92-4bf8-ae7b-1508200b34cd%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/1e5616bc-b9a4-417f-a411-c1be0eb4df3b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • [google-app... Koki
    • [googl... Parth Mishra
      • Re... 'Dangelo Trindade Santana' via Google App Engine
        • ... Koki
        • ... Koki
          • ... 'Yasser Karout (Cloud Platform Support)' via Google App Engine
      • [g... Koki

Reply via email to