url redirection with hash-bang char is not working in javascript -


this question has answer here:

i want redirect incoming urls from :

 http://example.com/#!foo 

to form :

 http://example.com/folder/#!foo 

how can using javascript?

i tried

 window.open('http://example.com/'+window.location.hash); 

but page not redirecting.

any idea?

not sure why previous attempts redirect hash-bang urls failed, after few modifications code worked fine. changed window.open() window.location.assign() .

 window.location.assign("http://www.example.com/folder/"+window.location.hash) 

Comments