Results 1 to 2 of 2

Help redirecting old urls

This is a discussion on Help redirecting old urls within the Off-Topic & Chit Chat forums, part of the Focus on Members category; Until last month i was using a 3rd party cms for my site. After 2 months of work i managed ...

  1. #1
    Junior Member Tefra's Avatar
    Real Name
    Chris T.
    Join Date
    Jan 2006
    Posts
    25
    Liked
    0 times

    Help redirecting old urls

    Until last month i was using a 3rd party cms for my site. After 2 months of work i managed to write from scratch my own custom cms as a vb product. I managed to preserve most of the urls but i had to change some. So i need help to redirect them. If it was 1-2 i wouldn't care but we talk about 11000 indexed links by yahoo and google. I plan to use vbseo functions for the cms in the future but it will take some time (study vbseo) as i plan to use the page titles for the ulrs rathen than using the easy way page.php?id=xx => page-xx.html.

    Anyway...

    Example old to new
    plug.php?e=terms => terms.php
    plug.php?e=gpudb => gpudb.php

    When it comes to htaccess i suck so i made a small php script to redirect the old urls to the new ones, with adding header 301.

    file plug.php
    PHP Code:
    <?PHP

    $url 
    $_SERVER['REQUEST_URI'];
    $parsed parse_url($url);

    parse_str($parsed['query'], $output);
    header("HTTP/1.1 301 Moved Permanently");
    switch(
    $output['e'])
    {
        case 
    'terms':

            if(!empty(
    $output['ltr']))
            {
                 
    header("Location: http://www.3dacc.net/terms.php?ltr=".$output['ltr']);
            }
            elseif(!empty(
    $output['item']))
            {
                
    header("Location: http://www.3dacc.net/terms.php?item=".$output['item']);
            }
            else
            {
                
    header("Location: http://www.3dacc.net/terms.php");
            }
        break;

        case 
    'startupdb':
            if(!empty(
    $output['ltr']))
            {
                 
    header("Location: http://www.3dacc.net/startup.php?ltr=".$output['ltr']);
            }
            elseif(!empty(
    $output['item']))
            {
                
    header("Location: http://www.3dacc.net/startup.php?item=".$output['item']);
            }
            else
            {
                
    header("Location: http://www.3dacc.net/startup.php");
            }
        break;
        
        case 
    'gpudb':
        case 
    'revdb':
        
            if(!empty(
    $output['series']))
            {
                 
    header("Location: http://www.3dacc.net/gpudb.php?series=".$output['series']);
            }
            elseif(!empty(
    $output['id']))
            {
                
    header("Location: http://www.3dacc.net/gpudb.php?id=".$output['id']);
            }
            else
            {
                
    header("Location: http://www.3dacc.net/gpudb.php");
            }
        break;    

        default:
            
    header("Location: http://www.3dacc.net");
        break;
    }
    ?>

    Everything works fine but i wonder about search bots, is it a good enough or do i need you to help me with htaccess ???

    Thanks in advance
    3D Accelerator www.3dacc.net
    Maximize your computer performance experience

  2. #2
    vBSEO Staff Oleg Ignatiuk's Avatar
    Real Name
    Oleg Ignatiuk
    Join Date
    Jun 2005
    Location
    Belarus
    Posts
    25,744
    Liked
    169 times
    Hello,

    that should be fine. It doesn't matter whether redirect is performed via .htaccess or in PHP script, important is only to send correct HTTP code and target URL.

Similar Threads

  1. Replies: 21
    Last Post: 04-05-2009, 09:53 PM
  2. Redirecting old URLs
    By turker in forum Pre-Sales Questions
    Replies: 5
    Last Post: 03-12-2007, 06:49 PM
  3. Replies: 2
    Last Post: 01-22-2007, 02:20 PM
  4. Redirecting a Url
    By cathiejones in forum General Discussion
    Replies: 1
    Last Post: 07-27-2006, 05:41 PM

Posting Permissions

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