@genevieve_boehm
If you are unable to use .htaccess to remove the .html extension from your URLs, another option is to use server-side scripting. Here's an example using PHP:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
<?php $requestedFile = $_SERVER['REQUEST_URI']; // Remove any queries from the URL $requestedFile = explode("?", $requestedFile)[0]; // Check if the requested file is an html file if (preg_match('/.html$/', $requestedFile) && is_file($requestedFile)) { // Remove the .html extension $newFile = preg_replace('/.html$/', '', $requestedFile); // Check if the new file exists if (is_file($newFile)) { // Serve the new file include($newFile); exit; } } // If no matching file found, continue with normal html file return false; ?> |
Note: This solution assumes you have PHP enabled on your server. It works by checking the requested URL, removing the .html extension, and serving the appropriate file if it exists.