PrestaShop Forum

The best place in the world to ask questions about PrestaShop and get advice from our passionate community!

PrestaShop Forum

Jump to content

 

[Solved] how to edit .htaccess file?

8 replies to this topic
#1
fitgura

    PrestaShop Apprentice

  • Members
  • PipPip
  • 203 posts
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

  • Members
  • PipPip
  • 203 posts
nobody knows??

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

#3
fitgura

    PrestaShop Apprentice

  • Members
  • PipPip
  • 203 posts
nobody knows, what is that?????????
The road to success always Under Construction!

#4
fitgura

    PrestaShop Apprentice

  • Members
  • PipPip
  • 203 posts
please help.........meeeeeeeee
The road to success always Under Construction!

#5
rocky

    PrestaShop Superstar

  • US Moderators
  • 9988 posts
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.

#6
fitgura

    PrestaShop Apprentice

  • Members
  • PipPip
  • 203 posts
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

  • US Moderators
  • 9988 posts
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.

#8
fitgura

    PrestaShop Apprentice

  • Members
  • PipPip
  • 203 posts
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

  • PrestaTeam
  • 9152 posts
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 :)