OpenCart – 404 error

Home Forums BulletProof Security Free OpenCart – 404 error

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #15233
    Corin
    Participant

    Hi, I hope that you can help

    We have a site, http://www.sunessences.org built using WordPress, that’s using the BulletProof plugin. Attached to the site is an e-shop (/shop) that uses OpenCart.

    We are trying to use SEO-friendly URLs for the shop and have made the required changes to the .htaccess in the /shop directory, plus the needed OpenCart setting changes. But when these changes are made, we constantly get Page Not found 404 errors (using the new ‘friendly’ URLs)

    After approaching our host provider, they have suggested that there could be a ‘conflict’ between the OpenCart .htaccess and the BulletProof .htaccess. They have suggested adding the following condition to the (BulletProof) .htaccess in our root directory – RewriteCond %{REQUEST_URI} !^/(shop/.*)$

    I have some questions:-

    a) Does this sound like good advice to fix our problem?
    b) Where in the BulletProof .htaccess file does this condition need to be added?
    c) Should this condition be added to every BulletProof .htaccess file? – I think we have two

    Apologies in advance if the questions are a little naïve – I’m not a developer!

    Thanks in advance for your reply
    Corin

    #15237
    AITpro Admin
    Keymaster

    OpenCart is a 3rd Party Application so you would use a 3rd party application RewriteRule for your OpenCart /shop folder.  Click the link below for step by step instructions on how to add a 3rd party application RewriteRule for your /shop folder.  Your RewriteRule would be:

    # RewriteRule for Custom Apps outside of WP
    RewriteRule ^shop/ - [L]

    http://forum.ait-pro.com/forums/topic/custom-applications-outside-of-wordpress-3rd-party-apps/

    #15248
    Corin
    Participant

    Many thanks for replying so quickly

    I followed the instructions to the letter, but unfortunately, I still have the problem as before.

    As soon as I switch on the OpenCart SEO friendly settings and rename the updated .htaccess that sits in the /shop directory where OpenCart is installed, I get 404 errors – even, for example, when I go to the shop home page: http://www.sunessences.org/shop or the OpenCart Admin utility

    Any further ideas of where the problem could be?

     

    #15250
    AITpro Admin
    Keymaster

    Actually after Googling what OpenCart SEO friendly settings are you would need to contact the OpenCart folks about this.  In this OpenCart Forum topic below they mention that there is a module for this.

    http://forum.opencart.com/viewtopic.php?f=20&t=89807

    IMPORTANT!:  Each website should have its own .htaccess file.  your main site:  BPS htaccess files.  your shop site:  opencart .htaccess file. you mentioned that you renamed the .htaccess file in the shop website.  each site needs its own .htaccess files in order for everything to work correctly and be compartmentalized.  good site architecture is that each site has its own .htaccess files.

    Generally with .htaccess code if you wanted to do redirects or rewriting for something like this – make ugly URL’s rewrite to nice looking URL’s you would use example .htaccess code like this below.

    This is just an example and you should NOT use this.  The scenario you have going on is much more complex.  You have 2 separate sites that should each have their own .htaccess files for rewriting URL’s for each site.  All rewriting for URL’s should be handled in the /shop site and you should not attempt to do this from/in your main site/main site .htaccess file.  You should ONLY need to tell your main site/main site .htaccess file to ignore or not process, rewrite URL’s that start with shop since your shop site should handle all rewriting for the shop site.

    # WP REWRITE LOOP START
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # BEGIN RewriteRules
    RewriteRule ^shop/blah(.*)$ /path-to-some-file/some-file.php [L]
    # END RewriteRules

    Something like this might work. It is not the best practice/structure to use, but it might work.

    # WP REWRITE LOOP START
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # BEGIN RewriteRules
    RewriteRule ^shop/(.*)$ /shop/$1 [L]
    # END RewriteRules

    Another possibility is if you are handling redirects/rewrites at the php level and are renaming the shop .htaccess file because php is now handling this then you can add a RewriteEngineOff .htaccess file in the /shop folder, which will tell your main site not to apply any .htaccess rules/rewriting to the /shop folder.  See the link below for how to create and add a RewriteEngine Off .htaccess file for your /shop website.

    http://forum.ait-pro.com/forums/topic/custom-applications-outside-of-wordpress-3rd-party-apps/

    #15259
    Corin
    Participant

    Many thanks for getting back to me again with more thoughts.

    As I mentioned in the OP, I’m not a developer and things are starting to get quite technical. I tried the simpler of the two ideas you suggested (turning off the ReWriteEngine in the /shop .htaccess) but the same problem.

    I think I will have to seek some advice from OpenCart experts, as it appear that some (most?) of the problem lies at their door. Like you, I Googled the 404 error issue and it would seem that although the approach to use friendly URLs is a simple one, many other people are having similar issues. In the worst case, if it cannot be fixed by an OpenCart ‘expert’ then there is the option, as you found, to buy a module and let it do the work!

    Once again, many thanks for the assistance and input

    #36675
    thietketino
    Participant

    This isn’t really all that hard to do,

    The not_found.tpl file is only for 404 errors in version 1.4.x and 1.5.x and you can safely edit this file, it will not affect the cart or any other errors pages as these are made using their respective controller.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.