M
M
Muhammadkhon Abdullaev2020-07-18 11:38:48
PHP
Muhammadkhon Abdullaev, 2020-07-18 11:38:48

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

4 answer(s)
N
nokimaro, 2020-07-18
@Muhammadkhonofficial

https://developer.mozilla.org/ru/docs/Web/API/Hist...

<script>
    window.history.replaceState({}, null, '/');
</script>

D
Dmaw, 2020-07-18
@Dmaw

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.

L
Lord_Dantes, 2020-07-18
@Lord_Dantes

Maybe you want to remove .html ?
Then in the site directory - create a folder example/ and put index.html/ in it

R
romaaa32, 2020-07-19
@romaaa32

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, instead http://сайт/admin/new-pageпришлосьof using http://сайт/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, the http://сайт/admindirectory address admin may not really exist.

PHP-routing (Routing) for beginners
Creating a CMS in php - lesson 5 (Router, Service part 1)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question