SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2007
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Redirecting 10,000 Broken Links

    I recently acquired an old search engine domain that I'm now using for a blog. The name is great, but unfortunately, nearly 10,000 (and counting) broken links for various searches are left behind. I can't seem to find a solution for redirecting only the broken links.

    1. ErrorDocument 404 / doesn't work. Maybe it's conflicting with my Wordpress .htaccess?
    2. None of the plug-ins for 301 redirection in Wordpress handle mass redirects.

    How can I redirect only the broken links on my site? Any help is greatly appreciated. I'm quite frustrated right now.

  2. #2
    SitePoint Wizard bronze trophy PicnicTutorials's Avatar
    Join Date
    Dec 2007
    Location
    Carlsbad, California, United States
    Posts
    3,656
    Mentioned
    15 Post(s)
    Tagged
    0 Thread(s)
    I don't think I understand where you are trying to redirect them too. But you have the option to do a blanket redirect of the entire domain to the new domains home page.

  3. #3
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,644
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    S_S,

    You've replaced a search engine with a WordPress website?

    My first reaction was to give up as WP will "take over" any 404 and redirect to its file handler (index.php). Then, the required "spark" suggested that the search engine used either (likely both) a search page such as search.php (hopefully not the same index.php that WP uses) AND/OR a query string that would have a specific key that you could use as a marker (to avoid the capture by WP). If either of these are the case, please advise and I can help you though the mod_rewrite code.

    PT also has a good point: What do you want to do with the search engine's 404's?

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  4. #4
    SitePoint Enthusiast
    Join Date
    Feb 2007
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by dklynn View Post
    S_S,

    You've replaced a search engine with a WordPress website?

    My first reaction was to give up as WP will "take over" any 404 and redirect to its file handler (index.php). Then, the required "spark" suggested that the search engine used either (likely both) a search page such as search.php (hopefully not the same index.php that WP uses) AND/OR a query string that would have a specific key that you could use as a marker (to avoid the capture by WP). If either of these are the case, please advise and I can help you though the mod_rewrite code.

    PT also has a good point: What do you want to do with the search engine's 404's?

    Regards,

    DK
    Thanks for the help! I actually just want to redirect them to the homepage. Wordpress seems to be catching these not-founds on its own and sending them to a custom 404 page.

    I'd like to set up code to redirect any page that does not exist to my homepage. So if you end up at /search.aspx?cute-kittens or /search.aspx?any-random-string, I'd like the visitor to be redirected to the homepage.

  5. #5
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,644
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    SS,

    What you're suggesting will disable WP's ability to use strings in your request which allow it to link to entries in its article database. Since mod_rewrite doesn't have the power to look into the database (unless you have SysAdmin privileges), you'll have to modify the WP code for 404 handling. You inferred that there is "a custom 404 page" so you could use that to simply redirect to the "clean" index.php ("homepage") script.

    If the last sentence needs clarification, find the 404 handler and add code to redirect to index.php WITHOUT adding a query string. If you can put it in the 404 handler's <head> section, a <meta> redirection would be optimal otherwise PHP or JavaScript code to change the location() would be necessary.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •