I am new to php stuff, so the question might be a bit stupid:
index.php
<?php
include "rest/db.php" ;
$db = OpenCon();
$request = $_SERVER['REQUEST_URI'];
switch ($request) {
case '/' :
require __DIR__ . '/home.php';
break;
case '/supply' :
require __DIR__ . '/supply.php';
break;
case '/about' :
require __DIR__ . '/about.php';
break;
case '/careers' :
require __DIR__ . '/careers.php';
break;
......//some more stuff
default:
http_response_code(404);
require __DIR__ . '/404-page.php';
.htaccess
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ index.php [QSA,L]
1 question:
I need to handle request to supply.php?page=5(or supply.php?page=5&offset=5)
. How do I need to change index.php
and htaccess
for that?
2 question:
I have admin template written in angular and hosted on the same hosting as this website(which is in php). Angular admin project is in /adminv1
folder. The problem with it is that, when I do refresh the page, it goes to 404
page and loses the styles. I guess this is happening because of the request handling in index.php
. What would be the simplest way to solve it?
Thanks in advance!