I Need Help With 301 Redirects Please Help

Discussion in 'PHP' started by suprastan, Jan 20, 2013.

  1. #1
    So I am trying to migrate an old CMS that was custom done in 1996 to Wordpress. I have done the content import into Wordpress and now am ready to move the WP site from a subdirectory to the root. I just need help doing the 301 redirects. If anyone is good with this please help.

    Here is some examples of the old to new structure.


    News:

    Old:

    http://www.gamesite.com/index.php?page=globalnews

    New:

    http://www.gamesite.com/category/news/

    Reviews:

    Old:

    http://www.gamesite.com/index.php?page=portal2&platform=&genre=&platform2=reviews

    New:

    http://www.gamesite.com/category/reviews/

    Previews:

    Old:

    http://www.gamesite.com/index.php?page=portal2&platform=&genre=&platform2=previews

    New:

    http://www.gamesite.com/category/previews/

    Articles:

    Old:

    http://www.gamesite.com/index.php?page=articles

    New:

    http://www.gamesite.com/category/articles/

    Interviews:

    Old:

    http://www.gamesite.com/index.php?page=interviews

    New:

    http://www.gamesite.com/category/interviews/

    ALso here is content:

    OLD:

    http://www.gamesite.com/index.php?page=gameportal&mode=reviews&id=556278

    New:

    http://www.gamesite.com/staying-out-of-reach/

    If you can help let me know.


    Thanks

    PS.. Domain name changed to protect..
     
    suprastan, Jan 20, 2013 IP
  2. amit0535

    amit0535 Active Member

    Messages:
    45
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    50
    #2
    You can add these rules in your .htaccess files.These rules will work for most of your URL but not for all because there is no method to determine new link on the basis of old URL(see your last URL).For those URLs you can add a custom rule for every URL or you can use PHP header("location:http://gamesite.com/newurl.php") to redirect.
    RewriteEngine on
    RewriteCond %{QUERY_STRING} ^platform2=(.+)$
    RewriteRule ^index.php $ http://gamesite.com/category/$1? [L,R=301]
    RewriteCond %{QUERY_STRING} ^page=(.+)$
    RewriteRule ^index.php $ http://gamesite.com/category/$1? [L,R=301]
    Code (markup):
     
    Last edited: Jan 20, 2013
    amit0535, Jan 20, 2013 IP
  3. phpexperts

    phpexperts Greenhorn

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    21
    #3
    phpexperts, Jan 21, 2013 IP