PrestaShop Forums: [Solved] how to edit .htaccess file? - PrestaShop Forums

Jump to content


Welcome to the PrestaShop Forum! We hope you'll share your comments and suggestions with us. We ask that you please post in English to the main sections of the PrestaShop Forum. If you want to write in another language, please post in the corresponding PrestaShop Community section below.

Please note that PrestaShop Community sections are largely self-moderated. PrestaShop team members may or may not participate in non-English sections. To improve the chances of receiving feedback to your question or comment, please post it in English to the main sections of our Forum.

NYC

Vous parlez français ? par ici !


[Solved] how to edit .htaccess file?


[Solved] how to edit .htaccess file?

#1 fitgura

    PrestaShop Apprentice

  • 07 Sep 2009
  • Members
  • PipPip
  • 183 posts

Posted 30 July 2010 - 05:31 AM

Hi all!

I just imported my products via csv (what contains : id; name; ean13; price; quantity;

Evrything works fine, but I wanted to switch on the frendly url option.

1. I mde a .htacces file
2 I generated the htaccess code

What I see now:

I see in the category: yoursite.com/5-categoryname

but I could need just the yoursite.com/categoryname without the ID code

and if I click in one of the product details I see the next

yoursite.com/categoryname/1-productname-prductEAN13code.html


but I could need it without the ID and without the EAN13 code

Is this possible to do it???

because I check in BO the frendly url ani it just contains the name without ID and EAN, so why it put in the html link??

can I modify somehow to see the desired url without unnecessary IDs and EAN????

my code:

# .htaccess automaticaly generated by PrestaShop e-commerce open-source solution
# http://www.prestashop.com - http://www.prestashop.com/forums

# URL rewriting module activation
RewriteEngine on

# URL rewriting rules
RewriteRule ^([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 errors
ErrorDocument 404 /404.php

The road to success always Under Construction!

#2 fitgura

    PrestaShop Apprentice

  • 07 Sep 2009
  • Members
  • PipPip
  • 183 posts

Posted 30 July 2010 - 09:57 AM

nobody knows??

how to take off ID code and ean13 from frendly url??
The road to success always Under Construction!

#3 fitgura

    PrestaShop Apprentice

  • 07 Sep 2009
  • Members
  • PipPip
  • 183 posts

Posted 30 July 2010 - 12:37 PM

nobody knows, what is that?????????
The road to success always Under Construction!

#4 fitgura

    PrestaShop Apprentice

  • 07 Sep 2009
  • Members
  • PipPip
  • 183 posts

Posted 30 July 2010 - 05:43 PM

please help.........meeeeeeeee
The road to success always Under Construction!

#5 rocky

    PrestaShop Superstar

  • 16 Oct 2008
  • US Moderators
  • 9981 posts
  • Location:Australia

Posted 31 July 2010 - 04:00 AM

This question has been asked many times before. It has even been answered by the PrestaShop team. See my post here.
Check out Nethercott Constructions for PrestaShop guides and modules. Like us on Facebook for news updates.

Guides Performance Guide | Installation Guide | Development Guide

Modules AJAX Sliding Categories | AJAX Dropdown Categories | Carousel | Image Gallery | Sliding Menu

All free and paid software, modules, themes and modifications are subject to the terms and conditions here.

#6 fitgura

    PrestaShop Apprentice

  • 07 Sep 2009
  • Members
  • PipPip
  • 183 posts

Posted 31 July 2010 - 06:36 AM

Ok. I tought it.... but even I don't know how to remove the ean13-code from the product link!!!!
The road to success always Under Construction!

#7 rocky

    PrestaShop Superstar

  • 16 Oct 2008
  • US Moderators
  • 9981 posts
  • Location:Australia

Posted 31 July 2010 - 06:54 AM

You'll need to change line 45 in classes/Link.php (in PrestaShop v1.3.1) from:


return ($this->allow == 1)?(_PS_BASE_URL_.__PS_BASE_URI__.$lang_link.(($id_product->category != 'home' AND !empty($id_product->category)) ? $id_product->category.'/' : '').intval($id_product->id).'-'.$id_product->link_rewrite.($id_product->ean13 ? '-'.$id_product->ean13 : '').'.html') :


to:


return ($this->allow == 1)?(_PS_BASE_URL_.__PS_BASE_URI__.$lang_link.(($id_product->category != 'home' AND !empty($id_product->category)) ? $id_product->category.'/' : '').intval($id_product->id).'-'.$id_product->link_rewrite/*.($id_product->ean13 ? '-'.$id_product->ean13 : '')*/.'.html') :


and line 48 from:


return ($this->allow == 1)?(_PS_BASE_URL_.__PS_BASE_URI__.$lang_link.(($category AND $category != 'home') ? ($category.'/') : '').intval($id_product).'-'.$alias.($ean13 ? '-'.$ean13 : '').'.html') :


to:


return ($this->allow == 1)?(_PS_BASE_URL_.__PS_BASE_URI__.$lang_link.(($category AND $category != 'home') ? ($category.'/') : '').intval($id_product).'-'.$alias/*.($ean13 ? '-'.$ean13 : '')*/.'.html') :

Check out Nethercott Constructions for PrestaShop guides and modules. Like us on Facebook for news updates.

Guides Performance Guide | Installation Guide | Development Guide

Modules AJAX Sliding Categories | AJAX Dropdown Categories | Carousel | Image Gallery | Sliding Menu

All free and paid software, modules, themes and modifications are subject to the terms and conditions here.

#8 fitgura

    PrestaShop Apprentice

  • 07 Sep 2009
  • Members
  • PipPip
  • 183 posts

Posted 31 July 2010 - 07:59 AM

rocky! you are a hero!!

thank you very mutch!!! It works fine now!!!!

:)
The road to success always Under Construction!

#9 Patric Codron

    PrestaShop Superstar

  • 17 Jun 2008
  • PrestaTeam
  • 8896 posts

Posted 02 August 2010 - 12:36 PM

So I mark the topic as [Solved].
Please, next time, do it by yourself by adding [Solved] at the beginning of your topic's title by editing your first post !
Thanks. ;-)

Please read the PrestaShop.com forum's rules and advice for a better use
Patric CodronCommunity Manager | Manager de CommunautéPrestaShop

Posted Image Merci de respecter les règles du forum PrestaShop.com :)
Posted Image Please comply with the PrestaShop.com forum rules :)






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users