从网址中删除标题时自动加载php标头

I am creating PHP view details page I have added header function to auto loading title but it's not auto loading when i removed title from url this is my url http://localhost/zblog/source/22/xxxxxx

Here is my code

if (isset($_GET['srcid']) && empty($_GET['title'])) {
$srcid = $_GET['srcid'];
$title= $_GET['title'];
header('Location: /source/'.$_GET['srcid'].'/'.$_GET['title']);
}else{
header("location:error-404.php");
}