473,405 Members | 2,282 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

how to deal with the 404 page not found error

123 100+
i have some errors of 404 page not found when webmaster crawls my site.
i wanted to redirect to my home page when that error occurs.

i donno where should i do the general code for redirection.
I have code of ;

Expand|Select|Wrap|Line Numbers
  1. <?php 
  2. //errror404.php 
  3. echo "<font color="#FFFF00" size="3"><center><strong>You have reached a page that has changed or no longer exists. 
  4.       You have been redirected to our index page. Please update your bookmarks!</strong></center></font>";
  5. //Meta refresh to send them back to index.php 
  6. echo "<meta http-equiv="refresh" content="2;URL=/index.php">"; 
  7. include 'the main page of my website'; 
  8. ?> 
  9.  
Apr 18 '08 #1
2 1250
Markus
6,050 Expert 4TB
Right my friend.

Im assuming you want a custom 404 page - if you dont have access to the apache config file, then you can use htaccess.

Create a .htaccess file and put this in the file:
Expand|Select|Wrap|Line Numbers
  1. ErrorDocument 404 /404page.html
  2.  
Change the url to a relevant one!
Apr 18 '08 #2
ajd335
123 100+
Right my friend.

Im assuming you want a custom 404 page - if you dont have access to the apache config file, then you can use htaccess.

Create a .htaccess file and put this in the file:
Expand|Select|Wrap|Line Numbers
  1. ErrorDocument 404 /404page.html
  2.  
Change the url to a relevant one!
Thanks mark,
i wanted to create the custom 404 search page only...
if i have the access of apache config file,then should i create a new html file in which i should give the link of my home page or should i go for something else..
Apr 18 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Sean Pinto | last post by:
My hosting company has an automatic redirect page called /missing/missing.php and I want to log all of the page not founds that result in a redirection to missing.php. I can't seem to find out how...
13
by: teenzbutler | last post by:
I have a 10mb ASP file, which will not load in IE 6.0. I get an HTTP 500 error. When I convert the 10mb file to HTML, it loads fine. Is there a limitation on file size? If so, is there a tag I...
9
by: developer | last post by:
Does anyone know what is the way IE treats span tags(<span>) and table tags(<tr>, <td>)? Should the <span> tag be encolsed in tds and trs if it placed with other elements that are in a table? Can...
6
by: John Lau | last post by:
Hi, I am looking at the MS KB Article 306355: HOW TO: Create Custom Error Reporting Pages in ASP.NET by Using Visual C# .NET This article describes how to redirect errors to a custom html...
2
by: ypul | last post by:
on my local server i am getting ".net error" of "page not found " but on my hosting server I am not getting .net error ...I am getting the normal page not found error what could be the reason ?...
1
by: sam | last post by:
Hi, I have seen many posts about this problem and no resolution. I have set the maxRequestLength to 200K as I don't want anyone uploading files to the server greater than this size. I have...
7
by: Pat Carden | last post by:
I'm trying to provide a better user experience by redirecting my users to a "Page Not Found" page, using a Custom Errors directive in Web.Config. The problem is I need to return a 404 error code...
1
by: news.wanadoo.nl | last post by:
Hi, I have found whit google this form in this group. But i'n not good in javascript :(. I try and error normal but i only error now :P Whit i now want to now how can i get access to the vars...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.