s1
This commit is contained in:
28
.hta_404.php
28
.hta_404.php
@@ -4,19 +4,19 @@
|
||||
$headerContent = file_get_contents('./.hta_header.php');
|
||||
|
||||
$requestUri = $_SERVER['REQUEST_URI'];
|
||||
$parts = explode('/', $requestUri);
|
||||
$slug = $parts[2];
|
||||
$fileName = $slug;
|
||||
$fileExtension = explode('.', $fileName);
|
||||
// echo $requestUri;
|
||||
|
||||
$querySlug = '';
|
||||
if($fileExtension[1] && $fileExtension[1] === 'html'){
|
||||
$querySlug = $fileExtension[0];
|
||||
$urlParts = explode('/', $requestUri);
|
||||
|
||||
if($urlParts[1] === 'notice'){
|
||||
$slug = $urlParts[2];
|
||||
} else{
|
||||
$querySlug = $fileExtension[0];
|
||||
$slug = $urlParts[1];
|
||||
}
|
||||
|
||||
$querySlug = explode('.', $slug)[0];
|
||||
// echo $querySlug;
|
||||
$fileName = $slug;
|
||||
|
||||
try {
|
||||
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
@@ -48,8 +48,16 @@
|
||||
// } else{
|
||||
// $filePath = __DIR__ . '/notice/' . $fileName . '.html';
|
||||
// }
|
||||
$filePath = __DIR__ . '/notice/' . $fileName;
|
||||
$totalPageContent = $headerContent . $pageContent . $footerContent;
|
||||
|
||||
|
||||
if($urlParts[1] === 'notice'){
|
||||
$filePath = __DIR__ . '/notice/' . $fileName;
|
||||
$totalPageContent = $headerContent . $pageContent . $footerContent;
|
||||
} else{
|
||||
$filePath = __DIR__ . '/.hta_slug/' . $fileName;
|
||||
$totalPageContent = $headerContent . $pageContent . $footerContent;
|
||||
}
|
||||
|
||||
|
||||
file_put_contents($filePath, $totalPageContent);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user