Google App Engine - null domain redirection in Python

I am working on colorurl.com, and I need it so that users can enter colorurl.com/00ff00 (or some variations of this) and see the correct page. However, with a bare domain problem, users who type colorurl.com/somepath will be redirected to www.colorurl.com/.

Is there a way to detect this in python and then redirect the user to where they wanted to go (with www. Added?)

EDIT:

Clarification: in my web hosting configuration, I have colorurl.com forward at www.colorurl.com. They do not support path preservation (1 and 1). I have to discover the previous path and redirect users to it.

  • User goes to colorurl.com/path
  • The user is redirected to www.colorurl.com
  • The application should determine what the path is.
  • The application sends the user to www.colorurl.com/path
+4
source share
2 answers

In this scenario, I will create a small site in your bare domain, which consists only of a .htaccess file that redirects the path and everything to www. *:

Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} ^colorurl.com [NC] RewriteRule ^(.*)$ http://www.colorurl.com/$1 [L,R=301] 
+4
source

You need to use a third-party site to redirect to www. *; many registrars offer this service. The Godaddy service (which is even free with domain registration) directs foo.com/bar to www.foo.com/bar; I can’t talk about the possibilities of others, but it seems to me that anyone who does not behave in this way is violated.

0
source

All Articles