I want SOMETHING to be non mandatory so basically I want www.site.com/endpoint to redirect to www.site.com/something/endpoint automatically. I there a way to do it on one line?
Right now I am doing:
url(r'^SOMETHING/endpoint$', 'endpoint', name='endpoint'),
url(r'^endpoint$', RedirectView.as_view(url='SOMETHING/endpoint')),
Cheers.
url(r'^(SOMETHING/)?endpoint$', 'endpoint', name='endpoint')? I haven't done django but worth a shot.url(r'^[.*]?endpoint$', 'endpoint', name='endpoint')?