Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    Nov 2012
    Posts
    1
    Plugin Contributions
    0

    Default 301 Redirects Not Working Fully

    A category was moved and it created a new url so we had to create a 301 redirect in htaccess for the old url to the new one however the redirect is not working fully.

    The old url is http://www.worklinesafety.co.uk/safe...ts-c-6_32.html and the new one is http://www.worklinesafety.co.uk/safe...-6_119_32.html

    we placed in the htaccess the following code:
    Code:
    Redirect 301 /safety-footwear-rigger-boots-c-6_32.html http://www.worklinesafety.co.uk/safe...-6_119_32.html
    The redirect does cause a redirect however it loads as http://www.worklinesafety.co.uk/safe...ts-c-6_32.html As you can see the url is missing _119 Category ID.

    We use the Ultimate SEO URL plugin.

    We do have a few other 301 redirects that work 100% however we cannot figure this out.
    Code:
    Here is our full htaccess code incase there are any conflicts happening:
    ##### NOTE: Replace /shop/ with the relative web path of your catalog in the "Rewrite Base" line below:
    
    Options +FollowSymLinks
    RewriteEngine On
    RewriteBase /
    
    
    # From Ultimate SEO URLs
    RewriteRule ^(.*)-p-(.*).html$ index\.php?main_page=product_info&products_id=$2&%{QUERY_STRING} [L]
    RewriteRule ^(.*)-c-(.*).html$ index\.php?main_page=index&cPath=$2&%{QUERY_STRING} [L]
    RewriteRule ^(.*)-m-([0-9]+).html$ index\.php?main_page=index&manufacturers_id=$2&%{QUERY_STRING} [L]
    RewriteRule ^(.*)-pi-([0-9]+).html$ index\.php?main_page=popup_image&pID=$2&%{QUERY_STRING} [L]
    RewriteRule ^(.*)-pr-([0-9]+).html$ index\.php?main_page=product_reviews&products_id=$2&%{QUERY_STRING} [L]
    RewriteRule ^(.*)-pri-([0-9]+).html$ index\.php?main_page=product_reviews_info&products_id=$2&%{QUERY_STRING} [L]
    RewriteRule ^(.*)-ezp-([0-9]+).html$ index\.php?main_page=page&id=$2&%{QUERY_STRING} [L]
    
    # For Open Operations Info Manager
    RewriteRule ^(.*)-i-([0-9]+).html$ index\.php?main_page=info_manager&pages_id=$2&%{QUERY_STRING} [L]
    
    # For dreamscape's News & Articles Manager
    RewriteRule ^news/?$ index\.php?main_page=news&%{QUERY_STRING} [L]
    RewriteRule ^news/rss.xml$ index\.php?main_page=news_rss&%{QUERY_STRING} [L]
    RewriteRule ^news/archive/?$ index\.php?main_page=news_archive&%{QUERY_STRING} [L]
    RewriteRule ^news/([0-9]{4})-([0-9]{2})-([0-9]{2}).html$ index\.php?main_page=news&date=$1-$2-$3&%{QUERY_STRING} [L]
    RewriteRule ^news/archive/([0-9]{4})-([0-9]{2}).html$ index\.php?main_page=news_archive&date=$1-$2&%{QUERY_STRING} [L]
    RewriteRule ^news/(.*)-a-([0-9]+)-comments.html$ index\.php?main_page=news_comments&article_id=$2&%{QUERY_STRING} [L]
    RewriteRule ^news/(.*)-a-([0-9]+).html$ index\.php?main_page=news_article&article_id=$2&%{QUERY_STRING} [L]
    
    # All other pages
    # Don't rewrite real files or directories
    RewriteCond %{REQUEST_FILENAME} !-f [NC] 
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*).html$ index\.php?main_page=$1&%{QUERY_STRING} [L]
    
    rewritecond %{http_host} ^worklinesafety.co.uk [nc]
    rewriterule ^(.*)$ http://www.worklinesafety.co.uk/$1 [r=301,nc] 
    
    
    
    Redirect 301 /safety-footwear-rigger-boots-c-6_32.html http://www.worklinesafety.co.uk/safety-boots-rigger-boots-c-6_119_32.html
    Redirect 301 /safety-footwear-shoes-c-6_33.html http://www.worklinesafety.co.uk/safety-footwear-safety-shoes-c-6_33.html
    Redirect 301 /safety-boots-ankle-boots-c-6_31.html http://www.worklinesafety.co.uk/safety-boots-ankle-boots-c-6_119_31.html

  2. #2
    Join Date
    Nov 2007
    Location
    Woodbine, Georgia, United States
    Posts
    4,246
    Plugin Contributions
    58

    Default Re: 301 Redirects Not Working Fully

    Couple of issues to explain why it will never work....

    The original page (safety-footwear-rigger-boots-c-6_32.html) still works

    The original page (safety-footwear-rigger-boots-c-6_32.html) carries the same string/category assignment as the old (safety-boots-rigger-boots-c-6_119_32.html)

    The flaw, which has always existed in USEO is that the following urls will ALL load the same page.....

    safety-boots-rigger-boots-c-32.html
    -c-6_32.html
    something-something-something-c-6_119_32.html

    ~Melanie
    PRO-Webs, Inc. since 2003 :: Zen Cart Hosting :: Zen Cart SEO – 12 Steps to Success
    **I answer questions in the forum, private messages are not conducive to a helpful community.

  3. #3
    Join Date
    Feb 2012
    Location
    mostly harmless
    Posts
    1,809
    Plugin Contributions
    8

    Default Re: 301 Redirects Not Working Fully

    Quote Originally Posted by mprough View Post
    The flaw, which has always existed in USEO is that the following urls will ALL load the same page.....

    safety-boots-rigger-boots-c-32.html
    -c-6_32.html
    something-something-something-c-6_119_32.html
    This is not true in the current versions.

    You will notice the following line in the .htaccess file:
    Code:
    RewriteRule ^(.*)-c-(.*).html$ index\.php?main_page=index&cPath=$2&%{QUERY_STRING} [L]
    This line sends the URL generated by "Ultimate SEO URLs" to the Zen Cart dynamic URLs. Wait What? Yes, "Ultimate SEO URLs" internally uses the same URLs as Zen Cart!

    So "something-something-something-c-6_119_32.html" becomes "index.php?main_page=index&cPath=6_119_32".
    And "safety-boots-rigger-boots-c-32.html" becomes "index.php?main_page=index&cPath=32".
    And "-c-6_32.html" becomes "index.php?main_page=index&cPath=6_32".

    Newer versions of "Ultimate SEO URLs" use a slightly different .htaccess file with optimizations for performance.
    The glass is not half full. The glass is not half empty. The glass is simply too big!
    Where are the Zen Cart Debug Logs? Where are the HTTP 500 / Server Error Logs?
    Zen Cart related projects maintained by lhûngîl : Plugin / Module Tracker

  4. #4
    Join Date
    May 2011
    Posts
    67
    Plugin Contributions
    0

    Default Re: 301 Redirects Not Working Fully

    Hello,
    I'm hoping that perhaps you can help me. I am trying to redirect one of my product info pages to a defines page (don't ask why!).
    Here's the code in my htaccess:

    RewriteEngine On
    RewriteCond %{QUERY_STRING} ^main_page=document_product_info&cPath34&products_id=130$ [NC]
    RewriteRule ^(.*)$ http://mysite/index.php?main_page=about_us [R=301,L]

    I am pretty certain that the rewrite condition is correct as I've gotten the redirect to work "sometimes" -- meaning that messing with the rewrite rule, it previously redirected to my homepage instead of my about us page.
    I've messed around with the the last line some more, and now it doesn't redirect to anywhere.

    I don't know what I'm doing when it comes to the htaccess. The code snippets above I've gotten from mixing and matching from other posts.
    I think all I need is a correction on the rewrite rule.

    Thanks in advance for any suggestions!

  5. #5
    Join Date
    Nov 2007
    Location
    Woodbine, Georgia, United States
    Posts
    4,246
    Plugin Contributions
    58

    Default Re: 301 Redirects Not Working Fully

    Like this

    RewriteCond %{QUERY_STRING} main_page=document_product_info&cPath34&products_id=130
    RewriteRule (.*) http://mysite/index.php?main_page=about_us$1? [R=301,L]
    In the last line depending on how the resulting url looks, IE appended or not, then you may need to change to

    RewriteRule (.*) http://mysite/index.php?main_page=about_us$1 [R=301,L]
    or

    RewriteRule (.*) http://mysite/index.php?main_page=about_us [R=301,L]
    Cheers,
    Melanie
    PRO-Webs, Inc. since 2003 :: Zen Cart Hosting :: Zen Cart SEO – 12 Steps to Success
    **I answer questions in the forum, private messages are not conducive to a helpful community.

  6. #6
    Join Date
    Feb 2012
    Location
    mostly harmless
    Posts
    1,809
    Plugin Contributions
    8

    Default Re: 301 Redirects Not Working Fully

    You may also need to use multiple RewriteCond lines if the parameters are not always in the same order.

    Code:
    RewriteCond %{QUERY_STRING} main_page=document_product_info
    RewriteCond %{QUERY_STRING} cPath=34
    RewriteCond %{QUERY_STRING} products_id=130
    RewriteRule ^index.php$ http://mysite/index.php?main_page=about_us [R=301,L]
    The glass is not half full. The glass is not half empty. The glass is simply too big!
    Where are the Zen Cart Debug Logs? Where are the HTTP 500 / Server Error Logs?
    Zen Cart related projects maintained by lhûngîl : Plugin / Module Tracker

  7. #7
    Join Date
    May 2011
    Posts
    67
    Plugin Contributions
    0

    Default Re: 301 Redirects Not Working Fully

    Thanky much!

    This "RewriteRule (.*) http://mysite/index.php?main_page=about_us [R=301,L]" worked.

    Thanks again.

  8. #8
    Join Date
    May 2011
    Posts
    67
    Plugin Contributions
    0

    Default Re: 301 Redirects Not Working Fully

    For the rewrite conditions, both this:

    RewriteCond %{QUERY_STRING} main_page=document_product_info&cPath=34&products_id=130

    and this:

    RewriteCond %{QUERY_STRING} main_page=document_product_info
    RewriteCond %{QUERY_STRING} cPath=34
    RewriteCond %{QUERY_STRING} products_id=130

    worked.

    Thanks!

  9. #9
    Join Date
    Feb 2012
    Location
    mostly harmless
    Posts
    1,809
    Plugin Contributions
    8

    xhtml problem Re: 301 Redirects Not Working Fully

    You should place any 301 redirects BEFORE any RewriteRules. Otherwise your URL may be caught by the RewriteRules before the 301 is issued. (this is why you are losing the new category path)

    You are also missing a required block to send invalid URLs to Zen Cart's page_not_found from your .htaccess file.

    It appears from the .htaccess file you posted you are running an older version of "Ultimate SEO URLs". If you are on Zen Cart 1.5 you may wish to look into upgrading to the latest version.
    The glass is not half full. The glass is not half empty. The glass is simply too big!
    Where are the Zen Cart Debug Logs? Where are the HTTP 500 / Server Error Logs?
    Zen Cart related projects maintained by lhûngîl : Plugin / Module Tracker

 

 

Similar Threads

  1. v139h cant log in to admin and site is not fully working
    By rdsbaker in forum General Questions
    Replies: 5
    Last Post: 13 Dec 2013, 04:56 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
  •  
disjunctive-egg