How do i fix old 404 errors and redirect them to my new stuff?

5 replies
I have a lot of old articles that are getting sent to 404 pages.

lets say i had an article that was forwarding to www.abc.com/1

but now i no longer have the /1 site. I do have the www.abc.com and i forward that to my main sit but anyone that clicks on a link that has the abc.com/1 is sent to 404

How can i get it so the old www.abc.com/1 is ALSO fowarded like the domain.

Thanks
#404 #errors #fix #redirect #stuff
  • Profile picture of the author gotlinks
    .htaccess redirect it for a 301 perm redirect. Search google for the info
    Signature
    Learn the secrets to growing your Youtube Channel!

    - Feel free to private message me about anything. I love to help people and you are definitely no exception!
    {{ DiscussionBoard.errors[296836].message }}
  • Profile picture of the author AbbyP
    I'm pretty sure you can set the new redirect up easily right in CPanel too. There is usually an icon that says "redirects" in CPanel and when you click that it will let you choose between 301, 404, etc and you just enter what you're redirecting and where to.
    {{ DiscussionBoard.errors[296960].message }}
    • Profile picture of the author Jakehyten
      Originally Posted by AbbyP View Post

      I'm pretty sure you can set the new redirect up easily right in CPanel too. There is usually an icon that says "redirects" in CPanel and when you click that it will let you choose between 301, 404, etc and you just enter what you're redirecting and where to.
      just to let anyone else know that has this issue. This was VERY easy going into cpanel and using the redirect feature.
      {{ DiscussionBoard.errors[297540].message }}
  • Profile picture of the author JamesFraze
    Here is how I do it with Perl and htaccess

    But, it's for this format only:
    http://site.com/keyword.html

    in the .htaccess:
    RewriteEngine On
    RewriteRule ^([^/]*).html$ r.cgi?url=$1 [L]

    and the perl script called r.cgi

    #!/usr/bin/perl -T
    my $F = CGI::new();
    my $keyword = $F->param(url);
    # do whatever you want with the url, like map it to a table of urls
    # or send it to a mysql stop off to record the click and get the referrer, etc

    # the line below is manual, but like I said above, for thousands of links
    # you can have a small inline text database built into the script that routes
    # them wherever.

    # make this your destination
    my $to = qq~http://your.cool.nifty.com/link~;

    # this prints a 301 header (permanently moved), by default.
    # To specify 302 header (temporarily moved), you need a change it
    print $F->redirect($to);
    # end the r.cgi script



    The .htaccess has to be different depending on what you want it to match and redirect.

    It's the guts of my script at Link Redirection Service --- suprisingly nobody has messaged me asking about, so I guess it's only useful to me I'll shutup about it from now lol

    If you need help installing a custom version of this for yourself I'd love to get some testimonies in exchange for a few freebies (though I suspect all the seasoned IM'ers already have something like this)

    If anyone wants to know how to do it in php, asp, or just plain html post the request and I'll write up a tutorial
    {{ DiscussionBoard.errors[297591].message }}

Trending Topics