ckarone Posted April 2, 2012 Share Posted April 2, 2012 Hello Everything is in the title, i started my shop in French only but now I need also an English version. I used this tuto http://www.magavenue.com/blog/prestashop/supprimer-sous-dossier-fr-prestashop-14 but my French product urls give me a 404 error. Not that the English version is ok end everything is ok if url rewritting is disable. Have you an other solution to achive this ? Sorry for made bad English. Ckarone Link to comment Share on other sites More sharing options...
CartExpert.net Posted April 2, 2012 Share Posted April 2, 2012 Hello, This is for Magento. Link to comment Share on other sites More sharing options...
ckarone Posted April 2, 2012 Author Share Posted April 2, 2012 Thanks this is not the good link sorry. Here the good one http://www.magavenue.com/blog/prestashop/supprimer-sous-dossier-fr-prestashop-14 Ckarone Link to comment Share on other sites More sharing options...
CartExpert.net Posted April 2, 2012 Share Posted April 2, 2012 This problem appears with all pages? E.g. category pages and contact form too? Link to comment Share on other sites More sharing options...
ckarone Posted April 2, 2012 Author Share Posted April 2, 2012 No only on products pages. Link to comment Share on other sites More sharing options...
CartExpert.net Posted April 2, 2012 Share Posted April 2, 2012 So you receive 404 error only when you are trying to view the product pages info? Do you not recieve 404 error on contact page? Link to comment Share on other sites More sharing options...
ckarone Posted April 2, 2012 Author Share Posted April 2, 2012 Yes 404 error when i go to a French product page but not for the rest like category,contact, cms , .... And no problem when i want to display a English product page. Ckarone Link to comment Share on other sites More sharing options...
CartExpert.net Posted April 2, 2012 Share Posted April 2, 2012 Seems like you have an error in your htaccess. Link to comment Share on other sites More sharing options...
ckarone Posted April 2, 2012 Author Share Posted April 2, 2012 Yes, but where? This is the modification in the generateHtaccess method (This method generate the htaccess in the Tools.php classe) if($language['iso_code'] =='fr'){ foreach (Meta::getMetasByIdLang($language['id_lang']) as $key => $meta) if (!empty($meta['url_rewrite']) AND Validate::isLinkRewrite($meta['url_rewrite'])) $tab['RewriteRule']['content']['^'.$meta['url_rewrite'].'$'] = $meta['page'].'.php?isolang='.$language['iso_code'].' [QSA,L]'; elseif (array_key_exists($key, $default_meta) && $default_meta[$key]['url_rewrite'] != '') $tab['RewriteRule']['content']['^'.$default_meta[$key]['url_rewrite'].'$'] = $default_meta[$key]['page'].'.php?isolang='.$language['iso_code'].' [QSA,L]'; }else{ foreach (Meta::getMetasByIdLang($language['id_lang']) as $key => $meta) if (!empty($meta['url_rewrite']) AND Validate::isLinkRewrite($meta['url_rewrite'])) $tab['RewriteRule']['content']['^'.$language['iso_code'].'/'.$meta['url_rewrite'].'$'] = $meta['page'].'.php?isolang='.$language['iso_code'].' [QSA,L]'; elseif (array_key_exists($key, $default_meta) && $default_meta[$key]['url_rewrite'] != '') $tab['RewriteRule']['content']['^'.$language['iso_code'].'/'.$default_meta[$key]['url_rewrite'].'$'] = $default_meta[$key]['page'].'.php?isolang='.$language['iso_code'].' [QSA,L]'; $tab['RewriteRule']['content']['^'.$language['iso_code'].'/([^?&]*)'] = '$1?isolang='.$language['iso_code'].' [QSA,L]'; } Before it was foreach (Meta::getMetasByIdLang($language['id_lang']) as $key => $meta) if (!empty($meta['url_rewrite']) AND Validate::isLinkRewrite($meta['url_rewrite'])) $tab['RewriteRule']['content']['^'.$language['iso_code'].'/'.$meta['url_rewrite'].'$'] = $meta['page'].'.php?isolang='.$language['iso_code'].' [QSA,L]'; elseif (array_key_exists($key, $default_meta) && $default_meta[$key]['url_rewrite'] != '') $tab['RewriteRule']['content']['^'.$language['iso_code'].'/'.$default_meta[$key]['url_rewrite'].'$'] = $default_meta[$key]['page'].'.php?isolang='.$language['iso_code'].' [QSA,L]'; $tab['RewriteRule']['content']['^'.$language['iso_code'].'$'] = $language['iso_code'].'/ [QSA,L]'; $tab['RewriteRule']['content']['^'.$language['iso_code'].'/([^?&]*)$'] = '$1?isolang='.$language['iso_code'].' [QSA,L]'; Have you an idea? Link to comment Share on other sites More sharing options...
CartExpert.net Posted April 2, 2012 Share Posted April 2, 2012 It would be easier if you post the contents of the htaccess Link to comment Share on other sites More sharing options...
ckarone Posted April 5, 2012 Author Share Posted April 5, 2012 Hello, Here is a part of my htaccess ... RewriteRule ^([a-z]{2})/[a-zA-Z0-9-]*/([0-9]+)\-[a-zA-Z0-9-]*\.html /product.php?id_product=$2&isolang=$1 [QSA,L] RewriteRule ^([a-z]{2})/([0-9]+)\-[a-zA-Z0-9-]*\.html /product.php?id_product=$2&isolang=$1 [QSA,L] RewriteRule ^([a-z]{2})/([0-9]+)\-[a-zA-Z0-9-]*(/[a-zA-Z0-9-]*)+ /category.php?id_category=$2&isolang=$1&noredirect=1 [QSA,L] RewriteRule ^([a-z]{2})/([0-9]+)\-[a-zA-Z0-9-]* /category.php?id_category=$2&isolang=$1 [QSA,L] RewriteRule ^([a-z]{2})/content/([0-9]+)\-[a-zA-Z0-9-]* /cms.php?isolang=$1&id_cms=$2 [QSA,L] RewriteRule ^([a-z]{2})/content/category/([0-9]+)\-[a-zA-Z0-9-]* /cms.php?isolang=$1&id_cms_category=$2 [QSA,L] RewriteRule ^([a-z]{2})/([0-9]+)__[a-zA-Z0-9-]* /supplier.php?isolang=$1&id_supplier=$2 [QSA,L] RewriteRule ^([a-z]{2})/([0-9]+)_[a-zA-Z0-9-]* /manufacturer.php?isolang=$1&id_manufacturer=$2 [QSA,L] RewriteRule ^([0-9]+)(\-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-]*\.jpg$ /img/c/$1$2.jpg [L] RewriteRule ^([0-9]+)\-[a-zA-Z0-9-]*\.html /product.php?id_product=$1 [QSA,L] RewriteRule ^[a-zA-Z0-9-]*/([0-9]+)*\.html /product.php?id_product=$1 [QSA,L] RewriteRule ^([0-9]+)\-[a-zA-Z0-9-]*(/[a-zA-Z0-9-]*)+ /category.php?id_category=$1&noredirect=1 [QSA,L] RewriteRule ^([0-9]+)\-[a-zA-Z0-9-]* /category.php?id_category=$1 [QSA,L] RewriteRule ^([0-9]+)__([a-zA-Z0-9-]*) /supplier.php?id_supplier=$1 [QSA,L] RewriteRule ^([0-9]+)_([a-zA-Z0-9-]*) /manufacturer.php?id_manufacturer=$1 [QSA,L] RewriteRule ^content/([0-9]+)\-([a-zA-Z0-9-]*) /cms.php?id_cms=$1 [QSA,L] RewriteRule ^content/category/([0-9]+)\-([a-zA-Z0-9-]*) /cms.php?id_cms_category=$1 [QSA,L] RewriteRule ^lang-([a-z]{2})/([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html /product.php?id_product=$3&isolang=$1 [QSA,L] RewriteRule ^lang-([a-z]{2})/([0-9]+)\-([a-zA-Z0-9-]*)\.html /product.php?id_product=$2&isolang=$1 [QSA,L] RewriteRule ^lang-([a-z]{2})/([0-9]+)\-([a-zA-Z0-9-]*) /category.php?id_category=$2&isolang=$1 [QSA,L] RewriteRule ^en/404-error$ /404.php?isolang=en [QSA,L] RewriteRule ^en/address$ /address.php?isolang=en [QSA,L] RewriteRule ^en/addresses$ /addresses.php?isolang=en [QSA,L] RewriteRule ^en/authentication$ /authentication.php?isolang=en [QSA,L] RewriteRule ^en/best-sales$ /best-sales.php?isolang=en [QSA,L] RewriteRule ^en/cart$ /cart.php?isolang=en [QSA,L] RewriteRule ^en/contact-us$ /contact-form.php?isolang=en [QSA,L] RewriteRule ^en/discount$ /discount.php?isolang=en [QSA,L] ... Thanks Ckarone Link to comment Share on other sites More sharing options...
ckarone Posted April 5, 2012 Author Share Posted April 5, 2012 OK i found the htaccess problem This is the wrong one : RewriteRule ^[a-zA-Z0-9-]*/([0-9]+)*\.html /product.php?id_product=$1 [QSA,L] This is the correct one : RewriteRule ^[a-zA-Z0-9-]*/([0-9]+)*\-[a-zA-Z0-9-]*\.html /product.php?id_product=$1 [QSA,L] I just have to find what's wrong in the generateHtaccess method modification. Ckarone Link to comment Share on other sites More sharing options...
ckarone Posted April 6, 2012 Author Share Posted April 6, 2012 OK, here is the solution In the Tools.php classe Find this : $tab['RewriteRule']['content']['^[a-zA-Z0-9-]*/([0-9]+)*\.html'] = 'product.php?id_product=$1 [QSA,L]'; change by: $tab['RewriteRule']['content']['^[a-zA-Z0-9-]*/([0-9]+)-[a-zA-Z0-9-]*\.html'] = 'product.php?id_product=$1 [QSA,L]'; Now i have to found a solution to redirect /en/ folder to a sub domaine. Have you a solution Ckarone Link to comment Share on other sites More sharing options...
CartExpert.net Posted April 6, 2012 Share Posted April 6, 2012 You can use redirects for it. Link to comment Share on other sites More sharing options...
ckarone Posted April 6, 2012 Author Share Posted April 6, 2012 Can you tell me more about redirections Ckarone 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