Page 1 of 1

rewrite the url using htaccess

Posted: Sun Feb 23, 2014 11:52 pm
by vijayalakshmi
Hi,

my url path is http://localhost/codeigniter/home when I click any link using ajax, then that url path as http://localhost/codeigniter/home#2users.....

But I need only http://localhost/codeigniter/home ....
How to write to hide the #2users from the last sements in url using codeigniter...

I am using htaccess to hide index.php... pls suggest to hide the #2users from url using htaccess file.........

Re: rewrite the url using htaccess

Posted: Mon Feb 24, 2014 12:30 pm
by requinix
You cannot hide the # using a .htaccess. The server never receives that piece of information at all.

But you shouldn't even hide it: changing the URL like that is what lets people bookmark or share the page. Otherwise all they could do is link to the homepage. If you don't care about your users then it still might not even be possible to hide - check with your CI settings or whatever to see if there's a way, and if not then you'll have to either live with it or use a different AJAX mechanism.