I have a Django based website. I would like to redirect URLs with the pattern servertest in them to the same URL except servertest should be replaced by server-test. So for example the following URLs would be mapped be redirected as shown below: http://acme.com/servertest/ => http://acme.com/server-test/ http://acme.com/servertest/www.example.com => http://acme.com/server-test/www.example.com http://acme.com/servertest/www.example.com:8833 => http://acme.com/server-test/www.example.com:8833 I can get the first example working using the following line in urls.py: ('^servertest/$', 'redirect_to', {'url': '/server-test/'}), Not sure how to do it for the others so only the servetest part of the URL is replaced. Continue reading...