Jump to content


Photo

Modify htaccess to show 404 error


  • Please log in to reply
2 replies to this topic

#1 websitings

websitings
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 08 June 2006 - 09:43 PM

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



#2 Kris

Kris
  • Staff Alumni
  • Advanced Member
  • 2,755 posts
  • LocationThe Internet

Posted 19 June 2006 - 11:02 AM

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.

#3 mtbrandall

mtbrandall
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 21 June 2006 - 10:43 AM

try just doing it in php and adding
<?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
}
?>





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users