1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Noob needs help with 301 redirect

Discussion in 'General Programming Chat' started by Ginger_Ale, Mar 9, 2013.

  1. Ginger_Ale

    Ginger_Ale Registered Member

    Joined:
    Feb 5, 2012
    Messages:
    66
    Likes Received:
    37
    Location:
    Argentina
    Hi, I know there are millions of places where 301 redirects are explained, but I'm a total noob when it comes to this, I've never touched the .htaccess before and I've tried some stuff and it didn't completely work.

    I have a domain with WP installed that has old backlinks to dynamic pages in a directory that no longer exists, and I want all those to redirect to the homepage, they are appearing as 404 errors in GWT.

    The old links look like:
    domain.net/olddirectory/?blablabla

    I tried some examples of redirects I found, but the result I get is that the links go to domain.net/?blablabla
    I don't really know if that is bad or not, but just in case...

    In short: How do I get rid of that annoying /?blablabla ? :pound:

    Thank you SO much ^^
     
  2. Ginger_Ale

    Ginger_Ale Registered Member

    Joined:
    Feb 5, 2012
    Messages:
    66
    Likes Received:
    37
    Location:
    Argentina
    Sorry about the shameless bump :tapedshut but I haven't taken care of this issue yet.

    Does somebody know how I could do that? Thanks a lot!
     
  3. innozemec

    innozemec Jr. VIP Jr. VIP

    Joined:
    Aug 19, 2011
    Messages:
    5,288
    Likes Received:
    1,799
    Location:
    www.Indexification.com
    Home Page:
    • Thanks Thanks x 1
  4. saber210

    saber210 Supreme Member

    Joined:
    Sep 1, 2011
    Messages:
    1,358
    Likes Received:
    500
    Location:
    -
    Put this on your 404.php on wordpress theme

     
    • Thanks Thanks x 1
  5. demanz

    demanz Newbie

    Joined:
    Jan 20, 2013
    Messages:
    38
    Likes Received:
    16
    Occupation:
    Procrastinator
    Location:
    England
    You could try the '404 redirected' plugin, works really well, can auto 301 your links or you can manually overide. It can also set up a custom 404 page with potential related links.

    It has the advantage of logging all 404s so you can even pick up ones that may not be showing in webmaster tools.

    Cheers

    D
     
  6. Foxy999

    Foxy999 Newbie

    Joined:
    Dec 30, 2012
    Messages:
    49
    Likes Received:
    4
    This can be done, even if the page has some get variables.

    Code:
    <?php header("Location: new-url"); exit(0); ?>
    You need to put add the exit function or php will parse any other code after the header function.

    If you need help specify get variables please let me know.

    Kindest Regards,