Results 1 to 4 of 4

Non-vBSEO .htaccess Help Needed

This is a discussion on Non-vBSEO .htaccess Help Needed within the General Discussion forums, part of the vBulletin SEO Discussion category; I switched from PhotoPost to vBAdvanced Gallery a long time ago, and I created some PHP files to redirect the ...

  1. #1
    Senior Member
    Real Name
    Keith Cohen
    Join Date
    Jul 2005
    Location
    Raleigh, NC USA
    Posts
    6,147
    Liked
    13 times

    Non-vBSEO .htaccess Help Needed

    I switched from PhotoPost to vBAdvanced Gallery a long time ago, and I created some PHP files to redirect the old links to the new links, but I would like to replace these with .htaccess entries and do a 301 redirect. Can anyone help?

    Here are my redirect scripts:

    /photopost/showgallery.php:
    Code:
    <?
    $PATH_INFO = getenv("PATH_INFO");
    if ( isset($PATH_INFO) ) {
    	$test = explode('/', substr($PATH_INFO,1));
    	for($i=0; $i < count($test); $i++){
    	    if($i % 2 == 0){ $$test[$i] = $test[$i+1];}
    	}
    }
    if (!isset($photo) ) 
    {
    	header("Location: /gallery/browseimages.php?c=" . $cat . "&u=" . $ppuser);
    } else {
    	header("Location: /gallery/showimage.php?i=" . $photo . "&c=" . $cat . "&u=" . $ppuser);
    }
    ?>

    /photopost/showmembers.php:
    Code:
    <?
    $PATH_INFO = getenv("PATH_INFO");
    if ( isset($PATH_INFO) ) {
    	$test = explode('/', substr($PATH_INFO,1));
    	for($i=0; $i < count($test); $i++){
    	    if($i % 2 == 0){ $$test[$i] = $test[$i+1];}
    	}
    }
    if (!isset($photo) ) 
    {
    	header("Location: /gallery/browseimages.php?c=" . $cat . "&u=" . $ppuser);
    } else {
    	header("Location: /gallery/showimage.php?i=" . $photo . "&c=" . $cat . "&u=" . $ppuser);
    }
    ?>
    /photopost/showphoto.php:
    Code:
    <?
    $PATH_INFO = getenv("PATH_INFO");
    if ( isset($PATH_INFO) ) {
    	$test = explode('/', substr($PATH_INFO,1));
    	for($i=0; $i < count($test); $i++){
    	    if($i % 2 == 0){ $$test[$i] = $test[$i+1];}
    	}
    }
    if (!isset($photo) ) 
    {
    	header("Location: /gallery/browseimages.php?c=" . $cat . "&u=" . $ppuser);
    } else {
    	header("Location: /gallery/showimage.php?i=" . $photo . "&c=" . $cat . "&u=" . $ppuser);
    }
    ?>

  2. #2
    vBSEO Staff Juan Muriente's Avatar
    Real Name
    Juan Carlos Muriente
    Join Date
    Jun 2005
    Location
    Puerto Rico
    Posts
    14,266
    Liked
    586 times
    I'm not absolutely sure which URLs should be redirected here, I guess they're the following:
    /photopost/showgallery.php/cat/X/ppuser/X/ => /gallery/browseimages.php?c=X&u=X
    /photopost/showgallery.php/cat/X/ppuser/X/photo/X/ => /gallery/browseimages.php?i=X&c=X&u=X

    /photopost/showmembers.php/cat/X/ppuser/X/ => /gallery/browseimages.php?c=X&u=X
    /photopost/showmembers.php/cat/X/ppuser/X/photo/X/ => /gallery/browseimages.php?i=X&c=X&u=X

    /photopost/showphoto.php/cat/X/ppuser/X/ => /gallery/browseimages.php?c=X&u=X
    /photopost/showphoto.php/cat/X/ppuser/X/photo/X/ => /gallery/browseimages.php?i=X&c=X&u=X
    The rewrite rules are:
    RewriteRule photopost/showgallery\.php/cat/([0-9]+)/ppuser/([0-9]+)/ gallery/browseimages.php?c=$1&u=$2 [L,R=301]
    RewriteRule photopost/showgallery\.php/cat/([0-9]+)/ppuser/([0-9]+)/photo/([0-9]+)/ gallery/browseimages.php?i=$3&c=$2&u=$1 [L,R=301]

    RewriteRule photopost/showmembers\.php/cat/([0-9]+)/ppuser/([0-9]+)/ gallery/browseimages.php?c=$1&u=$2 [L,R=301]
    RewriteRule photopost/showmembers\.php/cat/([0-9]+)/ppuser/([0-9]+)/photo/([0-9]+)/ gallery/browseimages.php?i=$3&c=$2&u=$1 [L,R=301]

    RewriteRule photopost/showphoto\.php/cat/([0-9]+)/ppuser/([0-9]+)/ gallery/browseimages.php?c=$1&u=$2 [L,R=301]
    RewriteRule photopost/showphoto\.php/cat/([0-9]+)/ppuser/([0-9]+)/photo/([0-9]+)/ gallery/browseimages.php?i=$3&c=$2&u=$1 [L,R=301]

  3. #3
    Senior Member
    Real Name
    Keith Cohen
    Join Date
    Jul 2005
    Location
    Raleigh, NC USA
    Posts
    6,147
    Liked
    13 times
    Well, close. My old URLs weren't using the /'s. They were using standard dynamic URLs. So I would just make those adjustments in the old URLS in your Rules?

    Example:

    RewriteRule photopost/showphoto\.php?cat=([0-9]+)&ppuser=([0-9]+)&photo=([0-9]+) gallery/browseimages.php?i=$3&c=$2&u=$1 [L,R=301]

    ?

    Thanks!

  4. #4
    vBSEO Staff Juan Muriente's Avatar
    Real Name
    Juan Carlos Muriente
    Join Date
    Jun 2005
    Location
    Puerto Rico
    Posts
    14,266
    Liked
    586 times
    Yes, it should work fine as in example you mention

Similar Threads

  1. vBSEO 2.4.0 Released - Includes Google AdSense Targeting Feature!
    By Juan Muriente in forum vBSEO Announcements
    Replies: 74
    Last Post: 05-20-2006, 09:29 PM
  2. vBSEO 2.0 RC7 Released
    By Juan Muriente in forum vBSEO Announcements
    Replies: 17
    Last Post: 09-08-2005, 11:00 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
  •