How to 301 Redirect All Requests on Google App Engine

We need two files to set this up:

app.yaml is the configuration file for the app. is a redirect script.


application: your-app-name
version: 1
runtime: python27
api_version: 1
threadsafe: no

– url: /.*

import webapp2

class MainPage(webapp2.RequestHandler):
def get(self):
self.redirect(“”, permanent=True)

app = webapp2.WSGIApplication([
(‘/.*’, MainPage),
], debug=True)

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *