diff --git a/.hta_404.php b/.hta_404.php index 7cb22b9..208fb9d 100644 --- a/.hta_404.php +++ b/.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); diff --git a/.hta_footer.php b/.hta_footer.php index ed58545..8e8327a 100644 --- a/.hta_footer.php +++ b/.hta_footer.php @@ -53,7 +53,4 @@ - - \ No newline at end of file + \ No newline at end of file diff --git a/.hta_header.php b/.hta_header.php index 52da0f2..1548a3a 100644 --- a/.hta_header.php +++ b/.hta_header.php @@ -249,37 +249,37 @@