Jump to content

Archived

This topic is now archived and is closed to further replies.

websitings

Modify htaccess to show 404 error

Recommended Posts

Greetings,

My website displays dynamic content from urls like this:

[a href=\"http://www.mydomain.com/index.php?f=whatever\" target=\"_blank\"]http://www.mydomain.com/index.php?f=whatever[/a]

Is it possible to modify the htaccess so that if a url does not contain ?f a header 404 message instead of a 200 success could be presented to the agent requesting the url.

Thanks for any assistance

Share this post


Link to post
Share on other sites
I know you can force users to a 403 (Forbidden) by using mod_rewrite in a .htaccess file. If that interests you, check the mod_rewrite section of the Apache manual, its in there somewhere.

Share this post


Link to post
Share on other sites
try just doing it in php and adding
[code]
<?php
if(!isset($_GET['f'])){ //see if ?f is not set
    header("Location: error404.php"); //send the user to the 404 page
    exit(); //terminate the script
}
?>
[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.