When using a url like this:
http://localhost/nafham/?selection/12/24/122
The hashing is done in that manner:
http://localhost/nafham/?selection/12/24/122#?selection/12/24/122/الصف-الثالث-الثانوي/السنة-كاملة/الاقتصاد/self
However when any other part added to the URL, example:
http://localhost/nafham/?selection/12/24/122/test
The hash is added again on each action
http://localhost/nafham/?selection/12/24/122/test#?selection/12/24/122/الصف-الثالث-الثانوي/السنة-كاملة/الاقتصاد/self
http://localhost/nafham/?selection/12/24/122//test#?selection/12/24/122/test#?selection/12/24/93/الصف-الثالث-الثانوي/السنة-كاملة/الاقتصاد/self
Any idea why the Hash is added to the URL instead of replacing the current hash value?
Because you are using the part of the URL when you set the hash.