Search code examples
jqueryhtmlurlhashtag

URL with Hash to be Clean URL


can someone please help me with this I want to make a url like this

http://www.website.com/#contactus

and would become and display a clean URL like this

http://www.website.com/contactus

but it will function the same as the hash url. Like when i include some jquery slides to it..

when i click

<a href="http://www.website.com/contactus">Contact Us</a>

it would slide to the div with id of contactus

<div id="contactus"></div>

without refreshing the page but it would change the url.

What tools will i use. Please guide me thank in advance. :)


Solution

  • .htaccess file:

    RewriteBase /
    
    RewriteEngine On
    RewriteBase /
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^/#(.*)$ index.php/$1