Answer the question
In order to leave comments, you need to log in
How to hide the page name after the address on the site?
Hello. I have such an unusual question. How can I hide the page name when going to it.
For example:
The user clicks on a link that leads to the example.html page. The address bar will display: forexample.com/example.html .
And I need it to be: forexample.com
PS I'm new to this area.
Answer the question
In order to leave comments, you need to log in
https://developer.mozilla.org/ru/docs/Web/API/Hist...
<script>
window.history.replaceState({}, null, '/');
</script>
It is possible to show the entire site through an iframe, then nothing will change in the address bar when navigating through the pages.
Or write to open pages via ajax.
Even through js, you can probably remove the extra part of the url.
Maybe you want to remove .html ?
Then in the site directory - create a folder example/ and put index.html/ in it
Front Controller (design pattern) - unifies all request processing by passing requests through a single handler object.
Routing is routing: the incoming URL is parsed in a special way and certain code is executed based on its result. Routing is directly related to the concept of CNC (human-understandable URLs), which allows you to exclude complex parameters from addresses. For example, insteadhttp://сайт/admin/new-pageпришлось
of usinghttp://сайт/admin.php?action=new-page
Any incoming URL on the server is parsed according to a single standard. I will not give the documentation in full (see the parse_url function as an example), it is only important to understand that the path parameter (the path on the server) is passed in the address, which may not actually exist on the server. For example, thehttp://сайт/admin
directory address admin may not really exist.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question