A URL for the entire site

0

is it possible to make the URL for an entire site the same?

For example www.midominio.com , by clicking on a section sends you to iframe and the URL changes to: www.midominio.com/Aplicaciones_Usuarios . But could you leave the same URL? that is still www.midominio.com but is already in iframe ? If there is a method, they could tell me what it's called or what to do or what language.

    
asked by ASpong 06.11.2018 в 00:13
source

1 answer

2

Let's see, I've done a onepage, but as your colleagues tell you, it's not normal, and most importantly, by having only one URL, the subject of SEO will be more complicated. But although it is not natural, it is not impossible. What I did was play a lot with the POST, since it is a variable that is overwritten, as long as you use the same position. I also tell you that I do not remember much of how I did it since a few years ago, anyway I will try to comment on it as accurately as possible. Another against of this type of pages is the complicated that becomes its maintenance ...

In the PHP file, which is where I also showed the HTML content, it did the following:

$page= $_POST['page'];
switch($page)  {
case 'index':
    /* Aquí introducirías el código de la página index. Yo te aconsejaría insertando otro archivo que contenga el contenido de la página index. */
    break;
default:
    /* Lo que quieras ejecutar cuando una página no se encuentra, normalmente es un 404 not found. */

Then what you could do is that the links or buttons have the ID of the page you want to redirect to, for example:

/* Si quieres que sea un botón: (Yo te aconsejaría este) */
<button class='link' id='index'>Index</button>

/* Si quieres que sea un enlace: */
<a href='#' class='link' id='index'>Index</a>

And then with ajax what you should do is take the ID of the selected item and send it by $ _POST ['page'] (or the position you want) to the file that contains the switch.

$('.link').click(function () {
    $.ajax({
    'url': 'index.php',
    'data': array(
        'page' => $(this).val(),
    )
    'type': 'POST',
})

Anyway, I repeat again that I would not do it as aesthetic as it is, because it is quite complex, it hurts you in SEO and so on.

NOTE: The code posted has not been tested, and I'm not entirely sure if the ajax works if you copy it, it's more orientative.

I hope it helps, greetings.

    
answered by 06.11.2018 в 09:18