Rewrite or redirect old URLS

Discussion in 'Apache' started by SEOjumper, May 3, 2007.

  1. #1
    I have upgraded my cart (X-CART) to latest version and I have a problem with URL structure as I would like it to change.


    The old stucture was:
    PHP files - *.php (not blocked by robots.txt)
    HTML files - replicated store with static HTML catalog in /catalog/ (for better search engine positions)
    /catalog/p"productid"-"product-name".html


    Now with the new version I use MOD (XC SEO) that uses MOD_REWRITE to rewrite PHP files to HTML. It puts everything to the root (I want it that way)

    For instance:
    /product.php?productid=11111
    becomes
    /canon-a640-camera



    Now I would like to redirect OLD CATALOG html urls from OLD STORE to new urls MODED with MODREWRITE.

    OLD URLS:
    /catalog/p"productid"-"product-name".html


    NEW URLS
    /"product-name"-p"productid" (no ending)

    Product name and productid are the same in both cases!


    Due to I already have some rewrite rules in htaccess setup by XC SEO mod, should I create a map with 301 redirects, or should I rewrite those old URLS too?
    I have about 7500 products.

    I know I could retain the "old" product name with productid first and redirect only folder, but
    my test show that products rank better with "new" style.

    Thank you for your help!

    P.S.
    1 thing more... I could't find what [QSA,L] means. Usually i see here 301 as 301 redirect?

    
    my curent .htaccess product rules
    
    ##### XC SEO Lite
    
    # Rewrite SEO product URL's
    RewriteRule ^([^/]*/)?[^/]+-print-c-([0-9]+)-p-([0-9]+)-pr-([0-9]+)$		$1product.php?printable=Y&productid=$4&cat=$2&page=$3						[QSA,L]
    RewriteRule ^([^/]*/)?[^/]+-c-([0-9]+)-p-([0-9]+)-pr-([0-9]+)$			$1product.php?productid=$4&cat=$2&page=$3						[QSA,L]
    RewriteRule ^([^/]*/)?[^/]+-print-pr-([0-9]+)$							$1product.php?printable=Y&productid=$2						[QSA,L]
    RewriteRule ^([^/]*/)?[^/]+-pr-([0-9]+)$									$1product.php?productid=$2						[QSA,L]
    
    Code (markup):
    My SETUP
    Linux
    Apache 2.0
    MySQL 4.1
     
    SEOjumper, May 3, 2007 IP
  2. VimF

    VimF Well-Known Member

    Messages:
    307
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    118
    #2
    I suggest writing new rewrite rules for the new URLs (no ending) and keep both versions running.
     
    VimF, May 3, 2007 IP
  3. SEOjumper

    SEOjumper Peon

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I came up with this

    RedirectMatch 301 /catalog/p([0-9]{1,7})-(.*).html http://www.domain.net/TEST/$2-pr-$1

    and it works flawlessly... is it ok? Any better solution?
     
    SEOjumper, May 3, 2007 IP