Solved

Redirect my 404 pages to the homepage

Posted on 2010-11-24
4
563 Views
Last Modified: 2012-05-10
I have a site with many pages which have external links pointing to them.

I've renamed many pages on my site.


So now lots of those external links produce 404 pages on my site which is bad.


Question:
How can I (.htaccess?) redirect (301) all of those 404 pages to the homepage, so if a link points to http://mydomain.com/invalid_page.html

and that page doesn't exist, I want the user when clicking on that link to get to: http://mydomain.com


Thanks
0
Comment
Question by:xcdev
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 3

Expert Comment

by:PorterGraphics
ID: 34208203
You should be able to set up a custom 404 page through your host provider. Select your homepage as the page that is displayed when a 404 error is encountered.
0
 
LVL 3

Expert Comment

by:KevinTHayashi
ID: 34208243
What is the webserver platform?  IIS, Apache, something else???

Do you have access to the webserver to make changes?  PorterGraphics is absolutely right on custom 404 error pages and something that is done all of the time.
0
 

Author Comment

by:xcdev
ID: 34208330
It is an apache server

I have access to it.


I want it to be a redirect so I won't lose the SEO, I don't want google to think I have abd page - a 404
0
 
LVL 3

Accepted Solution

by:
KevinTHayashi earned 500 total points
ID: 34208395
In your .htaccess file add a line for:

ErrorDocument 404 /index.html

More info here:
http://bignosebird.com/apache/a7.shtml

0

Featured Post

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Australian government abolished Visa 457 earlier this April and this article describes how this decision might affect Australian IT scene and IT experts.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question