How do I throw a 404 for a specific page with .HTACCESS?

Hi, for specific reasons I won’t go into I want “https://domain.com/” to throw a 404 error.
So only https in combination with the bare domain name as I’ve written it there.
E.g. “https://domain.com/page.php” should work fine.

How would I write this in .htaccess? (I did research it but couldn’t find anything that made this clear to me)

Does it have to be 404 not found, or would 403 forbidden be okay as well?

It has to be a 404

Apache can’t do that, you should do that from the file that is called.

Or maybe you can redirect the location to some other location that is allowed?

Rémon,

Sorry, mate, you can specify an R=404 when required. Select the file and send it to the 404 handler with an R=404 and that should do it for him.

Regards,

DK

But where do you send it to? You can’t send it to the requested location, that would be loopy …

In the Apache docs it does say the code has to be in the range 300-400 btw