.htaccess and url rewriting

i need the info about the htaccess and url rewriting
Nice, Create a blank php page in text editor

Copy the following code into the file:



<title> 404 Error Page</title>



<p align="center">

<h1>Error 404</h1>Page Not Found



$ip = getenv ("REMOTE_ADDR");

$requri = getenv ("REQUEST_URI");

$servname = getenv ("SERVER_NAME");

$combine = $ip . " tried to load " . $servname . $requri ;

$httpref = getenv ("HTTP_REFERER");

$httpagent = getenv ("HTTP_USER_AGENT");

$today = date("D M j Y g:i:s a T");

$note = "You have entered the wrong URL or clicked a broken link" ;

$message = "$today \n

$combine \n

User Agent = $httpagent \n

<h2> $note </h2>\n

$httpref ";

$message2 = "$today \n

$combine \n

User Agent = $httpagent \n

$note \n

$httpref ";

$to = "ContactEmail";

$subject = "Error Alert";

$from = "From: ReturnEmail\r\n";

mail($to, $subject, $message2, $from);

echo $message;


Visit our Home Page YourDomain


Change "You have entered the wrong URL or clicked a broken link" to the message you want your visitors to see and replace "YourDomain" with your actual domain URL or website name.

Replace "ContactEmail" with your actual email address so that you will receive an email message when someone lands on the 404 page. Additionally, replace "Error Alert" with the subject you wish to see in the alert email.

Replace "ReturnEmail" with the address that will appear in the "From" or "Recipient" field in your email program. You may use your own email address.

Choose "Save" from the File menu and type in "404.php." Ensure that you select "All File Types" when saving.

Now open notepad and write:
ErrorDocument 404 /errors/404.php

save it---file name: .htaccess
save as types: All files

keep both the files in root directory of your site e.g. localhost/example.com/
hope it will help you.


Please Login to post your reply or start a new topic