rewrite the url using htaccess

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
vijayalakshmi
Forum Newbie
Posts: 8
Joined: Tue Jan 21, 2014 10:22 pm

rewrite the url using htaccess

Post 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.........
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: rewrite the url using htaccess

Post 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.
Post Reply