Hash URL w / Javascript

I am trying to rewrite a url from the following:

http://www.asdf.com/index.php

to

http://www.asdf.com/#welcome
http://www.asdf.com/#test

Currently, the welcome / test pages are sliders on the page and they move it without changing the index.php url to greet / test. How can I directly link these sliders?

+3
source share
3 answers

Here is an article on bookmarking and back button with Ajax.

http://onjava.com/pub/a/onjava/2005/10/26/ajax-handling-bookmarks-and-back-button.html

+1
source

You would use some JavaScript on the page to determine which (if any) sliders are in the URL, and then trigger an action that exposes them.

0
source

you cannot change what the user has set in the url, you want to make sure your links are talking about it. The only way to change the URL is by redirecting. you will need to use something like .htaccess files on apache to rewrite .php URLs to "friendly" urls.

browsers automatically detect details after # and go to that part of the page (if it exists). It does nothing for the server.

0
source

Source: https://habr.com/ru/post/1789104/


All Articles