• Resolved goldmember

    (@goldmember)


    i recently changed my shopping cart and moved from a non wordpress shopping cart software to wordpress + shopp plugin.

    originally, links to different categories of my site looked like this:
    https://www.pooltees.com/products.php?cat=27 or
    https://www.pooltees.com/products.php?cat=28

    not they look like this:
    https://www.pooltees.com/shop/category/mens/ or
    https://www.pooltees.com/shop/category/womens/

    I’m trying to get my htaccess file to correctly redirect visitors to the new page when they find the old link in a google search. Installed these two lines of code:

    RewriteCond %{QUERY_STRING} ^products.php?cat=27$ [NC]
    RewriteRule ^/products.php$ https://pooltees.com/shop/category/chicks/ [R=301,L]

    into the htaccess file, but that doesnt seem to have worked. here’s a look at the entirety of the htaccess file:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteRule ^.*shop/images/(\d+)/?\??(.*)$ /wp-content/plugins/shopp/core/image.php?siid=$1&$2 [QSA,L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    RewriteCond %{QUERY_STRING} ^products.php?cat=27$ [NC]
    RewriteRule ^/products.php$ https://pooltees.com/shop/category/chicks/ [R=301,L]
    </IfModule>
    # END WordPress

    what am i doing wrong? please advise. thanks in advance.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    One thing you should do is keep your additions OUT of the WordPress stuff ?? This makes debugging a lot easier later on, and can remove conflicts.

    <IfModule mod_rewrite.c>
    RewriteEngine On
    # Redirect my old pages
    RewriteCond %{QUERY_STRING} ^products.php?cat=27$ [NC]
    RewriteRule ^/products.php$ /shop/category/chicks/ [R=301,L]
    
    # Redirect any of my old images
    RewriteRule ^.*shop/images/(\d+)/?\??(.*)$ /wp-content/plugins/shopp/core/image.php?siid=$1&$2 [QSA,L]
    </IfModule>
    
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress

    Now. You should read https://corz.org/serv/tricks/htaccess2.php – There’s a LOT of weirdness that goes into this stuff.

    Since you’re not actually re-writing the products.php call, you MIGHT be able to get away with:

    RewriteRule ^products.php?cat=27$ /shop/category/chicks/ [R=301,L]
    Thread Starter goldmember

    (@goldmember)

    i tried that but it still doesnt seem to be sending someone who goes to https://pooltees.com/products.php?cat=27 over to https://pooltees.com/shop/category/chicks/

    please advise.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Is the one for shop/images working?

    Possible fix:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    # Redirect my old pages
    RewriteCond %{QUERY_STRING} ^cat=27$ [NC]
    RewriteRule ^/products.php$ /shop/category/chicks/ [R=301,L]
    
    # Redirect any of my old images
    RewriteRule ^.*shop/images/(\d+)/?\??(.*)$ /wp-content/plugins/shopp/core/image.php?siid=$1&$2 [QSA,L]
    </IfModule>

    Thread Starter goldmember

    (@goldmember)

    I don’t know. When I installed shopp, that code was somehow automatically installed in the htaccess file. I’ve never touched the htaccess until I installed the two lines of additional code from my first post. So I’m not really sure what that image code is telling it to do. But none of the images from the wordpress site are in the same location as those from the previous site. I don’t know if that answers any questions…

    Thread Starter goldmember

    (@goldmember)

    well i found a great wordpress plugin that does this, called Simple 301 Redirects.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘htaccess 301 redirects with site transfer’ is closed to new replies.