For example, I would like to send the following links in an email to users:

  1. https://www.example.com/#foo
  2. https://www.example.com/deep-link/#foo

When clicked on, I get the following results:

  1. https://www.example.com/#foo
  2. https://www.example.com/register/user-information?view=login#foo

Both make sense. But once I log in, #foo is dropped from each URL.

1 Answer 1


The # and the string after together are called a fragment. Your question seems to suggest that you expect the fragment to be preserved as you run a post request (such as logging in) but that would be unnatural. Depending on what you are hoping to achieve you may be better off using a query string in your email link, or setting a cookie when a fragment is present. Perhaps you could edit your question with details of why you want the fragment to be appended to subsequent uris?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.