#1
  1. No Profile Picture
    Contributing User
    SEO Chat Explorer (0 - 99 posts)

    Join Date
    Sep 2011
    Posts
    33
    Rep Power
    8

    Opencart and 301


    Hi all,

    So the 301 redirect code that I've always used with every one of my websites without any problems now gives me 404's to all internal pages of my new Opencart website, what gives?

    Please see below the contents of my .htaccess:

    Code:
    RewriteEngine on
    RewriteCond %{HTTP_HOST} !^www\.mysite\.co\.uk
    RewriteRule (.*) http://www.mysite.co.uk/$1 [R=301,L] 
    RewriteCond %{THE_REQUEST} ^.*/index.php
    RewriteRule ^(.*)index.php$ http://www.mysite.co.uk/$1 [R=301,L]
    
    # 1.To use URL Alias you need to be running apache with mod_rewrite enabled. 
    
    # 2. In your opencart directory rename htaccess.txt to .htaccess.
    
    # For any support issues please visit: http://www.opencart.com
    
    Options +FollowSymlinks
    
    # Prevent Directoy listing 
    Options -Indexes
    
    # Prevent Direct Access to files
    <FilesMatch "\.(tpl|ini|log)">
     Order deny,allow
     Deny from all
    </FilesMatch>
    
    # SEO URL Settings
    RewriteEngine On
    # If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/ 
    
    RewriteBase /
    RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
    RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
    RewriteRule ^download/(.*) /index.php?route=error/not_found [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
    RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
    
    ### Additional Settings that may need to be enabled for some servers 
    ### Uncomment the commands by removing the # sign in front of it.
    ### If you get an "Internal Server Error 500" after enabling any of the following settings, restore the # as this means your host doesn't allow that.
    
    # 1. If your cart only allows you to add one item at a time, it is possible register_globals is on. This may work to disable it:
    # php_flag register_globals off
    
    # 2. If your cart has magic quotes enabled, This may work to disable it:
    # php_flag magic_quotes_gpc Off
    
    # 3. Set max upload file size. Most hosts will limit this and not allow it to be overridden but you can try
    # php_value upload_max_filesize 999M
    
    # 4. set max post size. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
    # php_value post_max_size 999M
    
    # 5. set max time script can take. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
    # php_value max_execution_time 200
    
    # 6. set max time for input to be recieved. Uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
    # php_value max_input_time 200
    
    # 7. disable open_basedir limitations
    # php_admin_value open_basedir none
    I'd appreciate any thoughts on this guys

    Many thanks.
  2. #2
  3. Super Moderator
    SEO Chat Mastermind (5000+ posts)

    Join Date
    Mar 2004
    Location
    Gloucester (South West UK).
    Posts
    6,533
    Rep Power
    3522
    Hi Nortski,

    I don't see any obvious problems, (although that file is a little messy, so I may have missed something)!

    I don't see any 301 redirects there except for lines 2,3 & 4,5 and they look like a canonical redirect & a standard "index.php" remover" to me ...
    If you are talking about those two, here's my preference:
    RewriteCond %{HTTP_HOST} ^website.co.uk
    RewriteRule (.*) http://www.website.co.uk/$1 [R=301,L]

    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php\ HTTP/
    RewriteRule ^(.*)index\.php$ /$1 [R=301,L]
    Since it's highly likely that only one of the redirects is causing the problem, you might want to try replacing one at a time, then checking results... (I'm guessing, but I'd try #2 first).

    If they still don't work, you can check the solutions available in the "canonical problems" links beneath my sig'.

    Good Luck.
    ClickyB
    "The quality of the visitor is more important than the volume..." (Egol 22nd Feb 2008)
    [New to SEO/SeoChat?] [Canonical Problems?] [Forum Rules & Posting Guidelines]
  4. #3
  5. No Profile Picture
    Contributing User
    SEO Chat Explorer (0 - 99 posts)

    Join Date
    Sep 2011
    Posts
    33
    Rep Power
    8
    Hi ClickyB, thanks for your reply.

    I just realised I attached the wrong code, please disregard it. Please see below, it's just the last line that has the 301 code I'm concerned with:

    Code:
    # 1.To use URL Alias you need to be running apache with mod_rewrite enabled. 
    
    # 2. In your opencart directory rename htaccess.txt to .htaccess.
    # For any support issues please visit: http://www.opencart.com
    Options +FollowSymlinks
    # Prevent Directoy listing 
    Options -Indexes
    # Prevent Direct Access to files
    <FilesMatch "\.(tpl|ini|log)">
     Order deny,allow
     Deny from all
    </FilesMatch>
    
    # SEO URL Settings
    RewriteEngine On
    # If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/ 
    RewriteBase /
    RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
    RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
    RewriteRule ^download/(.*) /index.php?route=error/not_found [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
    RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
    ### Additional Settings that may need to be enabled for some servers 
    ### Uncomment the commands by removing the # sign in front of it.
    ### If you get an "Internal Server Error 500" after enabling any of the following settings, restore the # as this means your host doesn't allow that.
    # 1. If your cart only allows you to add one item at a time, it is possible register_globals is on. This may work to disable it:
    # php_flag register_globals off
    # 2. If your cart has magic quotes enabled, This may work to disable it:
    # php_flag magic_quotes_gpc Off
    # 3. Set max upload file size. Most hosts will limit this and not allow it to be overridden but you can try
    # php_value upload_max_filesize 999M
    # 4. set max post size. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
    # php_value post_max_size 999M
    # 5. set max time script can take. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
    # php_value max_execution_time 200
    # 6. set max time for input to be recieved. Uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
    # php_value max_input_time 200
    # 7. disable open_basedir limitations
    
    
    # php_admin_value open_basedir none
    redirect 301 /6-goth-bracelets http://www.gothworld.co.uk/goth-bracelets
    Last edited by Nortski; Jun 3rd, 2014 at 04:31 PM.
  6. #4
  7. Super Moderator
    SEO Chat Mastermind (5000+ posts)

    Join Date
    Mar 2004
    Location
    Gloucester (South West UK).
    Posts
    6,533
    Rep Power
    3522
    Try this
    Code:
    RewriteRule ^6-goth-bracelets/.*$ http://www.gothworld.co.uk/goth-bracelets/ [R=301,L] 0
    Last edited by ClickyB; Jun 3rd, 2014 at 07:37 PM.
  8. #5
  9. No Profile Picture
    Registered User
    SEO Chat Explorer (0 - 99 posts)

    Join Date
    Jun 2014
    Posts
    2
    Rep Power
    0
    I am searching for a better shopping cart to develop my store and to cope with some issues in my X-Cart. Actually, among the huge amount of carts, I stopped at Protestant and Open Cart. It looks like they are easy and powerful enough. Can anybody tell me which is better? I am interested in SEO feature, modules and templates most of all.
  10. #6
  11. No Profile Picture
    Contributing User
    SEO Chat Explorer (0 - 99 posts)

    Join Date
    Sep 2011
    Posts
    33
    Rep Power
    8
    Originally Posted by ClickyB
    Try this
    Code:
    RewriteRule ^6-goth-bracelets/.*$ http://www.gothworld.co.uk/goth-bracelets/ [R=301,L] 0
    I'm afraid this didn't work, it just went to the original destination
  12. #7
  13. Super Moderator
    SEO Chat Mastermind (5000+ posts)

    Join Date
    Mar 2004
    Location
    Gloucester (South West UK).
    Posts
    6,533
    Rep Power
    3522
    Originally Posted by Nortski
    I'm afraid this didn't work, it just went to the original destination
    OK Sorry... (pesky mod_rewrite - lol) try:

    Code:
    RewriteRule /6-goth-bracelets/(.*)/goth-bracelets/$1 [L]
    (BTW: I am assuming that "6-goth-bracelets" was a folder and all files within are moved to your new "/goth-bracelets/" folder but have retained the file names... If not please let me know)!
  14. #8
  15. No Profile Picture
    Contributing User
    SEO Chat Explorer (0 - 99 posts)

    Join Date
    Sep 2011
    Posts
    33
    Rep Power
    8
    Originally Posted by ClickyB
    OK Sorry... (pesky mod_rewrite - lol) try:

    Code:
    RewriteRule /6-goth-bracelets/(.*)/goth-bracelets/$1 [L]
    (BTW: I am assuming that "6-goth-bracelets" was a folder and all files within are moved to your new "/goth-bracelets/" folder but have retained the file names... If not please let me know)!
    Nope that ain't working either lol


    /6-goth-bracelets was a friendly URL generated by Prestashop, this is what Google displays in it's SERPS when I search for 'goth bracelets' on google.co.uk.

    After moving to Opencart the URL is now /goth-bracelets, also a friendly URL.


    When I click on the Google search result it still tries to go to /6-goth-bracelets
  16. #9
  17. Super Moderator
    SEO Chat Mastermind (5000+ posts)

    Join Date
    Mar 2004
    Location
    Gloucester (South West UK).
    Posts
    6,533
    Rep Power
    3522
    Hmmm... I'm still not sure if those are folders (containing multiple files), or folders (containing only an index.php) or files (goth-bracelets.php)?
  18. #10
  19. No Profile Picture
    Contributing User
    SEO Chat Explorer (0 - 99 posts)

    Join Date
    Sep 2011
    Posts
    33
    Rep Power
    8
    Originally Posted by ClickyB
    Hmmm... I'm still not sure if those are folders (containing multiple files), or folders (containing only an index.php) or files (goth-bracelets.php)?
    They are not folders and they are not individual files lol I'm not entirely sure what they are, a module installed in the Opencart platform re-writes the original location, which I believe is a dynamically created .php file, to a more SEO friendly URL.


    It was the same for Prestashop but the SEO redirects worked with Prestashop.
  20. #11
  21. Super Moderator
    SEO Chat Mastermind (5000+ posts)

    Join Date
    Mar 2004
    Location
    Gloucester (South West UK).
    Posts
    6,533
    Rep Power
    3522
    Hmmm.. it seems opencart's rewriter and seo urls features are unusual.
    I've had a good look around and found lots of solutions (all different) and all seem to work for only some folks!
    I guess the opencart set up is key.

    I believe you'll find the answer in this thread in the opencart forum... (This is the one that seems to have helped most people).

    Sorry I couldn't be more help... Would be interested to know the answer when you get it.
  22. #12
  23. No Profile Picture
    Contributing User
    SEO Chat Explorer (0 - 99 posts)

    Join Date
    Sep 2011
    Posts
    33
    Rep Power
    8
    That's OK, I very much appreciate your time. I'll check out that link

Similar Threads

  1. A question about opencart and Magento?
    By cristinalynan in forum SEO Help (General Chat)
    Replies: 0
    Last Post: Aug 4th, 2012, 10:34 AM
  2. E-Commerce Platform OpenCart - url-seo-friendly - Duplicate Content??
    By unlimitedlight in forum Google Optimization
    Replies: 0
    Last Post: Sep 4th, 2011, 03:14 AM

IMN logo majestic logo threadwatch logo seochat tools logo