Results 1 to 8 of 8
  1. #1
    Join Date
    Nov 2008
    Posts
    164
    Plugin Contributions
    0

    Default Odd Category Redirect - using SSU

    I have a category "A" that is for some reason, redirecting to category "B". Category "B" was also disabled in the zenCart admin months ago.

    I have specifically set up my .htaccess to redirect category "B" to category "C" - which isn't working. All of the other redirects in my .htaccess are working.

    Has anyone run into this situation before - where a category suddenly redirects to another? I need to get my category "A" up and running again, is it's responsible for about 15% of my sales.

  2. #2
    Join Date
    Mar 2010
    Location
    UK
    Posts
    445
    Plugin Contributions
    0

    Default Re: Odd Category Redirect

    Let's see your code...

  3. #3
    Join Date
    Nov 2008
    Posts
    164
    Plugin Contributions
    0

    Default Re: Odd Category Redirect

    #### BOF SSU
    Options +FollowSymLinks -MultiViews
    RewriteEngine On

    RewriteRule ^shop/CategoryB$ http://www.mysite.com/CategoryC [R=301,L]
    RewriteRule ^shop/CategoryB/CategoryB-(.*)$ http://www.mysite.com/CategoryC/CategoryC-$1 [R=301,L]

    RewriteRule ^shop/(.*)$ http://www.mysite.com/$1 [R=301,L]
    RewriteRule ^shop$ http://www.mysite.com/ [R=301,L]
    RewriteRule ^index.html$ http://www.mysite.com/ [R=301,L]



    RewriteBase /

    # Deny access from .htaccess
    RewriteRule ^\.htaccess$ - [F]

    RewriteCond %{SCRIPT_FILENAME} !-f
    RewriteCond %{SCRIPT_FILENAME} !-d
    RewriteRule ^(.*) index.php?/$1 [E=VAR1:$1,QSA]
    #### EOF SSU
    Note that some of the rules are from re-directing the links from the old location of the store (mydomain.com/shop) to the new location (mydomain.com).

    As you can see, CategoryA isn't even mentioned in the .htaccess.

  4. #4
    Join Date
    Nov 2008
    Posts
    164
    Plugin Contributions
    0

    Default Re: Odd Category Redirect

    Forgot to mention that I'm running SSU.

  5. #5
    Join Date
    Nov 2008
    Posts
    164
    Plugin Contributions
    0

    Default Re: Odd Category Redirect

    After poking around the .htaccess (and my webhost breaking the site by modifying the .htaccess for me) I figured it had to be something to do with SSU. I had already tried resetting the category cache so I went ahead ran the "check and fix cache (run this once...)" and everything seems to be working again.

    Case closed.

  6. #6
    Join Date
    Mar 2010
    Location
    UK
    Posts
    445
    Plugin Contributions
    0

    Default Re: Odd Category Redirect

    Rule order optimised, added escaping in patterns, added non-www to www canonicalisation, and rewrite re-coded for better server efficiency:

    Code:
    # SSU SetUp
    Options +FollowSymLinks -MultiViews
    RewriteEngine On
    
    # Deny access to .htaccess
    RewriteRule ^\.htaccess$ - [F]
    
    # The "/" is the default value so remove the following line
    # RewriteBase /
    
    # Custom Redirects
    RewriteRule ^index\.html$ http://www.example.com/ [R=301,L]
    RewriteRule ^shop/CategoryB$ http://www.example.com/CategoryC [R=301,L]
    RewriteRule ^shop/CategoryB/CategoryB-(.*)$ http://www.example.com/CategoryC/CategoryC-$1 [R=301,L]
    RewriteRule ^shop(/index\.html)?$ http://www.example.com/shop/ [R=301,L]
    RewriteRule ^shop/(.*)$ http://www.example.com/$1 [R=301,L]
    
    # Canonical Redirect to www.example.com
    RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
    RewriteRule (.*) http://www.example.com/$1 [R=301,L]
    
    # SSU Rewrite
    RewriteCond %{REQUEST_URI} !\.(jpe?g|gif|png|css|js|zip)$
    RewriteCond %{SCRIPT_FILENAME} !-f
    RewriteCond %{SCRIPT_FILENAME} !-d
    RewriteRule ^(.*) index.php?/$1 [E=VAR1:$1,QSA]
    Every change is important, right down to the last slash and dot.

  7. #7
    Join Date
    Nov 2008
    Posts
    164
    Plugin Contributions
    0

    Default Re: Odd Category Redirect

    Quote Originally Posted by g1smd View Post
    Rule order optimised, added escaping in patterns, added non-www to www canonicalisation, and rewrite re-coded for better server efficiency:

    Code:
    # SSU SetUp
    Options +FollowSymLinks -MultiViews
    RewriteEngine On
    
    # Deny access to .htaccess
    RewriteRule ^\.htaccess$ - [F]
    
    # The "/" is the default value so remove the following line
    # RewriteBase /
    
    # Custom Redirects
    RewriteRule ^index\.html$ http://www.example.com/ [R=301,L]
    RewriteRule ^shop/CategoryB$ http://www.example.com/CategoryC [R=301,L]
    RewriteRule ^shop/CategoryB/CategoryB-(.*)$ http://www.example.com/CategoryC/CategoryC-$1 [R=301,L]
    RewriteRule ^shop(/index\.html)?$ http://www.example.com/shop/ [R=301,L]
    RewriteRule ^shop/(.*)$ http://www.example.com/$1 [R=301,L]
    
    # Canonical Redirect to www.example.com
    RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
    RewriteRule (.*) http://www.example.com/$1 [R=301,L]
    
    # SSU Rewrite
    RewriteCond %{REQUEST_URI} !\.(jpe?g|gif|png|css|js|zip)$
    RewriteCond %{SCRIPT_FILENAME} !-f
    RewriteCond %{SCRIPT_FILENAME} !-d
    RewriteRule ^(.*) index.php?/$1 [E=VAR1:$1,QSA]
    Every change is important, right down to the last slash and dot.
    Wow

    So, I should remove the: "RewriteBase"?

    On the following line, should it not re-direct to the mainsite instead of the /shop/ folder, since I moved the store out of that directory to the main folder?

  8. #8
    Join Date
    Mar 2010
    Location
    UK
    Posts
    445
    Plugin Contributions
    0

    Default Re: Odd Category Redirect - using SSU

    If this .htaccess file is placed in the root folder of your domain, it will redirect requests for files in the /shop/ folder to the same remainder path and filename (apart for the explicit coded exceptions), but in the root of the domain. Nothing in the code I supplied redirects to the /shop/ folder.

    To be clear, in a RewriteRule the Regular Expression pattern (on the left) is tested for a match with the requested URL specified in the literal GET /shop/somefile HTTP/1.1 request coming from the browser.

    The literal target (on the right) should be a full protocol+domain+path if the rule is a redirect. In that case the [R=301,L] flags should be added. If the literal target is without protocol and without domain and used only with the [L] flag then the result is an internal rewrite of the incoming URL request to a non-default internal filepath inside the server.
    Last edited by g1smd; 13 Jun 2010 at 05:52 PM.

 

 

Similar Threads

  1. Simple SEO URL (SSU) Module using category_name instead of actual category name
    By mayleesboutique in forum All Other Contributions/Addons
    Replies: 3
    Last Post: 17 Feb 2013, 12:12 PM
  2. Category depth using SSU, need opinions
    By swamyg1 in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 30 Nov 2012, 09:45 PM
  3. SSU Redirect many pages in site redesign, what's the best way?
    By swamyg1 in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 22 Mar 2011, 10:07 PM
  4. Please help with an infinite redirect loop using SSU 3.5.8
    By linnx in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 7 May 2010, 02:45 PM
  5. Using 301 Redirect with SSU
    By NBordeau in forum All Other Contributions/Addons
    Replies: 2
    Last Post: 1 May 2010, 11:05 PM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR