I am not sure if this is really a CodeIgniter issue or a browser issue. This happens in Chrome, but not Safari. However, I would assume it should not be happening in any browser.
If you go to example.com/foo# that contains
redirect('bar');
you would expect to end up at example.com/bar. Instead, you end up at example.com/bar#. I don’t understand why the hash does not go away. It makes no sense. What is going on?
it can’t. The hash tag is only accessible by a client side script. Code Igniter, PHP or any other server side script won’t even know what is after the # sign. The request sent to the server is that before the # sign. The part after #sign is passed to the document to interpret. If there is an element with the id as the # sign, the page scrolls down to it. Otherwise js can read it and do things with it as you desire.
Also, an HTTP redirect transfers the request with the same parameters as the original page, so the hastag is also passed on