Search code examples
javaurl-rewritinghttp-status-code-301

Google App Engine Java, 301 redirect with URL Rewrite Filter


I have my app engine project myproject.appspot.com hosted at myprojectsdomain.com. I want to permanently redirect all links at myprojectsdomain.com to brandNewDomain.com. I found the Java URL Rewrite filter at http://code.google.com/p/urlrewritefilter/ , but I'm not seeing the documentation on how to use this for a 301 redirect for changing the domain. All the examples seem to be for rewriting the url within the same domain, which doesn't do me much good in my current situation. Am I looking in the wrong places or is there a better way for me to permenantly redirect my Google App Engine Java project? Thanks!


Solution

  • Yes, you are looking at the wrong module. urlrewritefilter just changes the URL before your servlet gets to see it (but it still goes to that servlet). It does not do redirects.

    You can implement this yourself, by mapping all URL to a single servlet, which just returns the redirect response (response.sendRedirect).