I am trying to switch my website url to be "SEO Friendly" and i found a simple idea by php: so move every not found page to index.php by .htaccess:
ErrorDocument 404 /index.php
and from there i have in index.php:
$url = explode('/', urldecode($_SERVER['REQUEST_URI']));
if (empty($url[1])){
include "home.php";
die();
} else if($url[1] == "p"){
include "s/xp.php";
die();
} else if ( $url[1] == "d"){
include "s/xd.php";
die();
} else if ( $url[1] == "c"){
include "s/xc.php";
die();
} else {
http_response_code(404);
include('s/error.php');
die();
}
However, the server find this as 404, so i found a solution to add:
header("HTTP/1.1 200 OK");
now the pages open it works fine, nothing wrong! but when it comes to indexing! google find the pages are 404! even if they works fine!
is there a way to let the server believes its not error? or better solution?