L
L
LordPrimes2018-02-24 00:07:22
PHP
LordPrimes, 2018-02-24 00:07:22

How to set up a transition between pages?

Good afternoon. I wrote such a simple transition between pages, but I ran into one problem. All the page names for me will be get requests, this means that the question mark after the page name or the ID number will be ignored. I can’t figure out how to fix this, if someone not hard to tell.

$id = "main";
if (isset($_GET["id"])){
    $id = $_GET["id"];
}
if ($id == "") {
    $id = "main";
    
}
include ("pages/$id.php"); 
include ("pages/base.php");

.htaccess
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?id=$1

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
entermix, 2018-02-24
@entermix

Google: "PHP routing"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question