0

upon a 404 I want to set my htaccess file to utilize another file from another location in lieu of the missing file. The url must remain the same as if the file was in the directory & more importantly it must function as if it where the same location. So my main goal is to have a file directory without an index file. Is there a way to rewrite the file request to do this?

0

This might not be the answer you're looking for, but it's a good workaround:

Add your normal 404 error page to your .htaccess file:

ErrorDocument 404 /404.html

And in the 404.html file:

$Current_Url = $_SERVER['REQUEST_URI'];
if($Current_Url == "/Your_directory_here")
{
   require("index.html");  //The page that you want to show.
}
else
{
   //Normal 404 Stuff
}

In my answer, I'm assuming that your .html files are being parsed by php.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.