Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3791374
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T12:27:36+00:00 2026-05-19T12:27:36+00:00

I recently upgraded a site and almost all URLs have changed. I have redirected

  • 0

I recently upgraded a site and almost all URLs have changed. I have redirected all of them (or so I hope) but it may be possible that some of them have slipped by me. Is there a way to somehow catch all invalid URLs and send the user to a certain page and somehow know what URL the person came from so I could log this, and fix those? I’m thinking I could use .htaccess somehow but am not sure how. I am using PHP Thanks so much!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T12:27:36+00:00Added an answer on May 19, 2026 at 12:27 pm

    You could use a custom ErrorDocument handler written in PHP to catch URLs having “slipped by”:

    # .htaccess file
    ErrorDocument 404 /not-found.php
    

    And in not-found.php:

    switch($_SERVER['REDIRECT_URL']) {
        case '/really_old_page.php':
            header('HTTP/1.1 301 Moved Permanently');
            header('Location: /new-url/...');
        /*  As suggested in the comment, exit here.
            Additional output might not be handled well and
            provokes undefined behavior. */
            exit;
        default:
            header('HTTP/1.1 404 Not Found');
            die('404 - Not Found');
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a solution that uses EF Code First. I recently upgraded all my
I have a site I recently upgraded. The old site had a calendar that
I have recently upgraded a Drupal site to multi-webhead environment and am trying to
I have a site that was built using asp.net MVC version 1. I recently
I hope this is not to off-topic for this site. Recently I have had
I recently upgraded to the latest version of XCode, but apps made with this
I recently upgraded to Oracle Sql Developer 2.1 It's far better, but the query
My company recently upgraded from IE 6 to IE 8. My site does not
I recently upgraded my solution from .net framework 3.5 to 4.0. All good except
We recently upgraded an intranet site created in SharePoint 2003 to SharePoint 2007. After

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.