How can I hide #! on the address bar of the browser?

Let's say I have the following link:

www.blahblah.com/#!?page=index

How to convert it to one of the following:

  • www.blahblah.com/#!/index (this must be done using mod_rewrite)
  • www.blahblah.com/ajax/index (still mod_rewrite, but #! replaced by ajax)
  • www.blahblah.com/index (the page will be loaded using AJAX, for example facebook, but #! will be hidden)

Can someone give me examples of each of the above questions?

Thanks a lot!

+5
source share
4 answers

, (#) , . JavaScript. , , window.location.hash.

- :

hashString = window.location.hash.substring(8);
window.location = 'http://www.blahblah.com/'+hashString;

substring (#!?page=), index.

+3

, . , , js.

Facebook - , URL- , . , , , ​​ , , , , php, .

+1

The hidden # in the ajax page loading strategy is done using HTML 5 pushState.

+1
source

In javascript you can use window.location.hashfor this.

0
source

All Articles