I have a web site at:
http://example.com
when a new user first hits the web site I am creating a unique ID of 5 characters for them (for example abcde) and redirecting them to http://example.com/abcde so they can later bookmark and return to their workspace.
My question is: what is the best approach for SEO purposes, I need the main URL example.com to be indexed but Google will also get the redirect and will not index the main page.
I know about canonical URLs, but this applies only when the example.com URL does not redirect.
Also should I use 301 or 302 code in the redirect?