the second listing of the details page in the URL is needed for the redirect to occur.
Security assist uses the access check querystring variable to know what the previous page was.
to get the product id in the querystring as well, you will need to edit the restrict access code.
edit the redirect:
to capture the product ID querystring. for example, if the querystring is named productID:
edit the redirect code to: