How to exchange content without changing structure?

0

I started to make a website in the same code. Except that this site will have several pages on it on every page, the structure is the same, what changes is just the content. To not have to do in the code page by page, make a lot of pages, I want to use a default structure by doing include with php and getting content in mysql .

Example:

link

asked by anonymous 06.05.2018 / 02:36

1 answer

1

If you already have everything ready, you can set the .htaccess file to create a friendly url, as the stackoverflow itself uses, a simple example:

<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteRule ^pagina/([0-9]+)/?$ /index.php?pagina=$1 [NC]
</IfModule>

This will cause examplo.com/pagina/n pages, where n to be any integer, to be redirected to index.php , there you can get the page with get and use to fetch the data in the database

<?php
    echo $_GET["pagina"];
?>

To better understand how to use the .htaccess file, see this article

    
06.05.2018 / 20:49