How to rewrite a URL

0

Good afternoon, guys. Could you help me with my doubt? I wanted to rewrite a URL.

For example:

<a href="#Contato">Contato</a>

that points to a DIV ID Contact, however, the URL is:

https://site.com/index.php#Contato

and wanted to stay:

https:site.com/Contato

I've tried setting up htaccess, however, nothing has changed: (

    
asked by anonymous 19.09.2018 / 19:14

1 answer

0

If you literally want to redirect to the url, just remove the "#", getting

<a href="Contato">Contato</a>

Now if you want to keep the anchor function and just change the url visually without doing a redirect, you need the pushState of history.

Example:

<a href="#Contato" onclick="history.pushState('Contato','Titulo contato','/Contato'); return false;">Contato</a>

Source: link

    
02.10.2018 / 02:14