Flaunt Posted November 12, 2010 Share Posted November 12, 2010 Hi there,I was recently asked to upgrade someones shop from the very old 1.1.0.5 version to the latest one. I haven't done that yet but I did do something to their site by mistake when looking through the files on the server.They were using the friendly URL option and had a .htaccess file that was modified to make it work. I modified this slightly on my desktop for use on another server but forgot to make a copy and deleted it by accident from their server. Even though I thought I could change it back, whenever I upload it back to their site I get errors that the website has 'too many re-directs' or something and doesn't work. I can't seem to generate a new one as there is no option in the BO of this older version.So, I removed it all together and also switched off 'friendly URL' in the BO so that you can browse the products and site will work as normal. The huge problem I have, though is with the category list on the main home page.The main headings work fine but the branches underneath each category (which relate to a product, not a sub-category) no longer work. If you hover the mouse over the link it shows that it will try to go to "www.shopname.co.uk/30-pouffe-bean-bag.html" but the link for that product is now obviously "www.shopname.co.uk/product.php?id_product=30"Can anyone please tell me how to make those links go to the right place again?? (the unfriendly URL, if you like). I really need help with this. The site is a prominent and successful one and I need a fix urgently!Many thanks. Any questions, just ask.**********************edit* I'm thinking it may have something to do with 'category-tree-branch.tpl' in the theme folder. At first glance it seems to be a modified version than the standard because there are mentions of 'link re-writes' in it. What do we think? Link to comment Share on other sites More sharing options...
Flaunt Posted November 12, 2010 Author Share Posted November 12, 2010 Just to clarify, the 'category branches' on the homepage each link to an individual product not a sub-category. Wherever this mod was done (if it is that) I need to make it so they go to the standard product id as per my original post above, not the friendly URL......now that I've broken the .htaccess file..I have tried putting back the standard .htaccess file to make friendly URL work but I just get errors saying about 'too many re-directs'???? And the site doesn't open.Don't know if this will help but this is what their 'category-tree-branch.tpl' file looks like: > {if $node.children|@count > 0} {$node.name|escape:'htmlall':'UTF-8'} {else} {$node.name|escape:'htmlall':'UTF-8'} {/if} {if $node.children|@count > 0} </pre> <ul> {foreach from=$node.children item=child name=categoryTreeBranch} {if $smarty.foreach.categoryTreeBranch.last} {include file=$tpl_dir./category-tree-branch.tpl node=$child last='true'} {else} {include file=$tpl_dir./category-tree-branch.tpl node=$child last='false'} {/if} {/foreach} </ul> <br> {/if Link to comment Share on other sites More sharing options...
jhnstcks Posted November 12, 2010 Share Posted November 12, 2010 Sounds like the links have been hard coded into the category block, has the blockcategories.tpl file been altered? Link to comment Share on other sites More sharing options...
Flaunt Posted November 12, 2010 Author Share Posted November 12, 2010 Not sure. This is what it says: ( I think you're probably right about the hard-coding and i guess the links they put in were based on the friendly URL being switched on. If I can find where they did it I can tell them to go to the old style links instead) [removed][removed] <!-- Block categories module --> <!--{l s='Categories' mod='blockcategories'}--> {foreach from=$blockCategTree.children item=child name=blockCategTree} {if $smarty.foreach.blockCategTree.last} {include file=$branche_tpl_path node=$child last='true'} {else} {include file=$branche_tpl_path node=$child} {/if} {/foreach} <!-- /Block categories module --> If you want to see what I mean, it's here >> http://cozibag.co.ukThanks*edit* going back to this .htaccess problem. Why, if I create my own and add it does it say (when I click on a product) that it's "in a re-direct loop" error?? Odd... Link to comment Share on other sites More sharing options...
jhnstcks Posted November 12, 2010 Share Posted November 12, 2010 Is that the categories block they are using or have they got a different one installed, because the front-end doesnt look like the default categories block, but the file you posted above is the default version.As for the htaccess, try creating it bit by bit then you will see where the loop is coming from. Link to comment Share on other sites More sharing options...
Flaunt Posted November 12, 2010 Author Share Posted November 12, 2010 I took that one directly from the module folder on the site. I don't see another one. Is there anywhere else they could have made this modification? Link to comment Share on other sites More sharing options...
jhnstcks Posted November 12, 2010 Share Posted November 12, 2010 No, its definitly in that module, you can see if you look at the source code its in the block categories module. Have you tried replacing the category-tree-branch.tpl file with an unmodified version? Link to comment Share on other sites More sharing options...
Flaunt Posted November 12, 2010 Author Share Posted November 12, 2010 Not yet, no. I've just opened the page in Google Chrome, right-clicked on the area and selected 'inspect element' and amongst the code I can clearly see the part where code for the link is and everything else pertaining to these branches. But I can't determine where this file is?? Going to try and look again... Link to comment Share on other sites More sharing options...
Flaunt Posted November 12, 2010 Author Share Posted November 12, 2010 Well...I'm at a loss here. Is there any possible other place where the links may be? They have to be somewhere in some form or another I would have thought? If I can just locate them and alter the href then I'm done!What a headache......lol Link to comment Share on other sites More sharing options...
jhnstcks Posted November 12, 2010 Share Posted November 12, 2010 What I would do is download their blockcategories to my pc, uninstall it, delete it from the server and then upload a fresh version and see what happens. Link to comment Share on other sites More sharing options...
jhnstcks Posted November 12, 2010 Share Posted November 12, 2010 OK looks like it is the category-tree-branch.tpl file. > {$node.name|escape:htmlall:'UTF-8'} {if $node.children|@count > 0} </pre> <ul> {foreach from=$node.children item=child name=categoryTreeBranch} {if $smarty.foreach.categoryTreeBranch.last} {include file=$tpl_dir./category-tree-branch.tpl node=$child last='true'} {else} {include file=$tpl_dir./category-tree-branch.tpl node=$child last='false'} {/if} {/foreach} </ul> <br> {/if}<br this the file from a fresh, v1.1 download. Link to comment Share on other sites More sharing options...
Flaunt Posted November 12, 2010 Author Share Posted November 12, 2010 I'm a little reluctant to try that just yet as I don't want to risk completely breaking it or losing it. I'm only doing tests at the moment as it's a busy website so I can't afford any mistakes just yet, especially if I can't change it back. That's not a criticism against your suggestion.....just want to leave it as a last resort for the moment! Thanks for the ideas so far. If you think of anything else then please let me know. Thank You Link to comment Share on other sites More sharing options...
Flaunt Posted November 12, 2010 Author Share Posted November 12, 2010 Sorry, I wrote my last reply before I saw your post about the category-tree-branch.tpl file. So, it's definitely different. Do you think replacing it with this original one would solve the problem? Or will it make those links on the left disappear?Thanks Link to comment Share on other sites More sharing options...
jhnstcks Posted November 12, 2010 Share Posted November 12, 2010 I think it will make them disappear, as it seems to be forcing the sub-categories open all the time.Maybe you should concentrate on fixing the htaccess rather than the categories block Link to comment Share on other sites More sharing options...
Flaunt Posted November 12, 2010 Author Share Posted November 12, 2010 That's what I feared....Of course, the simplest thing would be to make the .htaccess file work so I can switch friendly URL's back on..then the links will work again. I really can't understand why it won't have it. The original had a number of rewrite additions but I even tried the basic one that Prestashop would normally accept and it simply won't work.Is there any chance some other part of the Prestashop could be causing it to not work? Perhaps another file got damaged when I broke the .htaccess one? Clutching at straws maybe, I dunno......haha Link to comment Share on other sites More sharing options...
jhnstcks Posted November 12, 2010 Share Posted November 12, 2010 Paste the htaccess file please.This is the htaccess from v1.1 # URL rewriting module activation RewriteEngine on # URL rewriting rules RewriteRule ^([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ product.php?id_product=$2$4 [L,E] RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ product.php?id_product=$1$3 [L,E] RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ category.php?id_category=$1 [QSA,L,E] RewriteRule ^content/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ cms.php?id_cms=$1 [QSA,L,E] RewriteRule ^([0-9]+)__([a-zA-Z0-9-]*)(.*)$ supplier.php?id_supplier=$1$3 [QSA,L,E] RewriteRule ^([0-9]+)_([a-zA-Z0-9-]*)(.*)$ manufacturer.php?id_manufacturer=$1$3 [QSA,L,E] # Catch 404 errors ErrorDocument 404 /404.php Link to comment Share on other sites More sharing options...
Flaunt Posted November 12, 2010 Author Share Posted November 12, 2010 This is the one that was originally on the server. There is one line missing from near the top but that was just a rewrite for the 'blog' CMS.The part in I have added a comment to (for your benefit) was the only part I originally changed because I was going to make a copy of their site on another server to run some upgrade tests. I put back in what I thought was the original info so I have mentioned it in case it looks wrong?Thanks # URL rewriting module activation RewriteEngine on -missing 'blog part was here- # URL rewriting rules RewriteRule ^([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ product.php?id_product=$2$4 [L,E] RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ product.php?id_product=$1$3 [L,E] RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ category.php?id_category=$1 [QSA,L,E] RewriteRule ^content/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ cms.php?id_cms=$1 [QSA,L,E] RewriteRule ^([0-9]+)__([a-zA-Z0-9-]*)(.*)$ supplier.php?id_supplier=$1$3 [QSA,L,E] RewriteRule ^([0-9]+)_([a-zA-Z0-9-]*)(.*)$ manufacturer.php?id_manufacturer=$1$3 [QSA,L,E] # Catch 404 errors ErrorDocument 404 /404.php # Canonicalisation fix - uncomment these lines when website goes live <<<<< this is the bit I originally changed [b]RewriteCond %{HTTP_HOST} !^www.cozibag..co.uk$ RewriteRule ^(.*)$ http://www.cozibag.co.uk/$1 [R=301,L] RewriteBase / RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/ RewriteRule index\.php$ / [R=301,L] RewriteBase / RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/ RewriteRule index\.html$ / [R=301,L] # Speed up site download mod_gzip_on Yes mod_gzip_dechunk Yes mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$ mod_gzip_item_include handler ^cgi-script$ mod_gzip_item_include mime ^text/.* mod_gzip_item_include mime ^application/x-javascript.* mod_gzip_item_exclude mime ^image/.* mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.* Link to comment Share on other sites More sharing options...
jhnstcks Posted November 12, 2010 Share Posted November 12, 2010 The bit you have tried to bold, there is an error in the url, there is 2 fullstops. [b]RewriteCond %{HTTP_HOST} !^www.cozibag..co.uk$ RewriteRule ^(.*)$ http://www.cozibag.co.uk/$1 [R=301,L] Link to comment Share on other sites More sharing options...
Flaunt Posted November 12, 2010 Author Share Posted November 12, 2010 Well, well....it worked! Well spotted!Thanks for that, I would never have noticed that mistake. Thanks very much for your help, you're a lifesaver Link to comment Share on other sites More sharing options...
jhnstcks Posted November 13, 2010 Share Posted November 13, 2010 If we had looked at htaccess in the first place, would have solved it faster. Link to comment Share on other sites More sharing options...
Radiator Posted November 18, 2010 Share Posted November 18, 2010 Hello,help needed after I turned on friendly URL my links are broken and images do not show up.See below my .htaccess file. Presta v 1.3.1Thank You# .htaccess automaticaly generated by PrestaShop e-commerce open-source solution# http://www.prestashop.com - http://www.prestashop.com/forums# URL rewriting module activationRewriteEngine on# URL rewriting rulesRewriteRule ^([a-z0-9]+)\-([a-z0-9]+)(\-[_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)\.jpg$ /img/p/$1-$2$3.jpg [L,E]RewriteRule ^([0-9]+)\-([0-9]+)/([_a-zA-Z0-9-]*)\.jpg$ /img/p/$1-$2.jpg [L,E]RewriteRule ^([0-9]+)(\-[_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)\.jpg$ /img/c/$1$2.jpg [L,E]RewriteRule ^lang-([a-z]{2})/([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$3&isolang;=$1$5 [L,E]RewriteRule ^lang-([a-z]{2})/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$2&isolang;=$1$4 [L,E]RewriteRule ^lang-([a-z]{2})/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /category.php?id_category=$2&isolang;=$1 [QSA,L,E]RewriteRule ^([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$2$4 [L,E]RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$1$3 [L,E]RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /category.php?id_category=$1 [QSA,L,E]RewriteRule ^content/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /cms.php?id_cms=$1 [QSA,L,E]RewriteRule ^([0-9]+)__([a-zA-Z0-9-]*)(.*)$ /supplier.php?id_supplier=$1$3 [QSA,L,E]RewriteRule ^([0-9]+)_([a-zA-Z0-9-]*)(.*)$ /manufacturer.php?id_manufacturer=$1$3 [QSA,L,E]RewriteRule ^lang-([a-z]{2})/(.*)$ /$2?isolang=$1 [QSA,L,E]# Catch 404 errorsErrorDocument 404 /404.php Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now