Jump to content
HA!*!*Y

[Override] Friendly URLs without ID number

Recommended Posts

Works with or with out /en/

 

 

Home Page URL:

http://www.example.com/en/

 

CMS page:

http://www.example.c...ontent/about-us

http://www.example.c...t/category/help

 

Category page

http://www.example.com/en/Electronics

 

Product page:

http://www.example.c...i-1450-LMT.html

 

Manufacturer

http://www.example.com/en/mfg/Garmin

 

Supplier

http://www.example.c...n/suplr/Bestbuy

 

 

 

To Install copy the the files in to override folder:

/override/classes/Link.php

/override/classes/Tools.php

 

/override/controllers/CategoryController.php

/override/controllers/CMSController.php

/override/controllers/ManufacturerController.php

/override/controllers/ProductController.php

/override/controllers/SupplierController.php

 

 

 

Than go to Back Office > Tools > Generators > Generate .htaccess file

 

Your all Done!

 

for Prestashop 1.5: http://www.prestashop.com/forums/index.php?/topic/204935-override-friendly-urls-without-id-number-for-v15/page__view__findpost__p__1011168

Edited by HA!*!*Y (see edit history)
  • Like 8

Share this post


Link to post
Share on other sites

If I have a previous version installed, removeURLid_v0.1b.2, should I uninistall it first?

 

Also, can you clarify if I put the override folder in the root directory? Or do I copy the files in the override folder to replace PS's files in the classes and controller folders?

 

 

Works with or with out /en/

 

 

Home Page URL:

http://www.example.com/en/

 

CMS page:

http://www.example.c...ontent/about-us

http://www.example.c...t/category/help

 

Category page

http://www.example.com/en/Electronics

 

Product page:

http://www.example.c...i-1450-LMT.html

 

Manufacturer

http://www.example.com/en/mfg/Garmin

 

Supplier

http://www.example.c...n/suplr/Bestbuy

 

 

 

To Install copy the the files in to override folder:

/override/classes/Link.php

/override/classes/Tools.php

 

/override/controllers/CategoryController.php

/override/controllers/CMSController.php

/override/controllers/ManufacturerController.php

/override/controllers/ProductController.php

/override/controllers/SupplierController.php

 

 

 

Than go to Back Office > Tools > Generators > Generate .htaccess file

 

Your all Done!

  • Like 1

Share this post


Link to post
Share on other sites

Yes uninistall the old module 1st, also remove the code from bottom of your ./config/config.inc.php file placed by old module.

 

Copy the filles in to your override directory of PS

 

Tested on prestashop 1.4.7.3

  • Like 1

Share this post


Link to post
Share on other sites

Works with or with out /en/

 

 

Home Page URL:

http://www.example.com/en/

 

CMS page:

http://www.example.c...ontent/about-us

http://www.example.c...t/category/help

 

Category page

http://www.example.com/en/Electronics

 

Product page:

http://www.example.c...i-1450-LMT.html

 

Manufacturer

http://www.example.com/en/mfg/Garmin

 

Supplier

http://www.example.c...n/suplr/Bestbuy

 

 

 

To Install copy the the files in to override folder:

/override/classes/Link.php

/override/classes/Tools.php

 

/override/controllers/CategoryController.php

/override/controllers/CMSController.php

/override/controllers/ManufacturerController.php

/override/controllers/ProductController.php

/override/controllers/SupplierController.php

 

 

 

Than go to Back Office > Tools > Generators > Generate .htaccess file

 

Your all Done!

 

Hi again HA!*!*Y,

Thanks for your quick reply too. I see you are the master of this module and a prestashop expert.

Well, I follow your instructions and copy all the files mentioned above from the zip into my FTP prestashop override folders. But didn't work either: evenmore, I didn't have the chance to generate the .htaccess file because I got a web error message.

Thanks for your help and goodwill, but it's driving me crazy...

Share this post


Link to post
Share on other sites

Yes uninistall the old module 1st, also remove the code from bottom of your ./config/config.inc.php file placed by old module.

 

Copy the filles in to your override directory of PS

 

Tested on prestashop 1.4.7.3

 

Can you clarify which chunk of code to remove from the config.inc.php? Or is it already removed?

 

I see this at the bottom:

 

 

 

/* Smarty */

require_once(dirname(__FILE__).'/smarty.config.inc.php');

/* Possible value are true, false, 'URL'

(for 'URL' append SMARTY_DEBUG as a parameter to the url)

default is false for production environment */

define('SMARTY_DEBUG_CONSOLE', false); //remove link id by Ha!*!*y

if (Tools::getValue('product_name_seo'))

{

$id_product = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('

SELECT `id_product`

FROM `'._DB_PREFIX_.'product_lang`

WHERE `link_rewrite` = \''.Tools::getValue('product_name_seo').'\'');

$_GET['id_product'] = $id_product;

}

else if (Tools::getValue('category_name_seo'))

{

$id_category = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('

SELECT `id_category`

FROM `'._DB_PREFIX_.'category_lang`

WHERE `link_rewrite` = \''.Tools::getValue('category_name_seo').'\'');

$_GET['id_category'] = $id_category;

}

//remove link id by Ha!*!*y

Share this post


Link to post
Share on other sites

I should also mention that when trying to uninstall removeURLid_v0.1b.2 there is an error. I can disable it, but cannot uninstall. Not sure if that makes a difference...

 

error2.pngThe following module(s) were not installed successfully:

  • removeurlid

 

Yes uninistall the old module 1st, also remove the code from bottom of your ./config/config.inc.php file placed by old module.

 

Copy the filles in to your override directory of PS

 

Tested on prestashop 1.4.7.3

Share this post


Link to post
Share on other sites

Can you for Debugging on your site edit your file config.inc.php so you could see all of the errors.

 

/* Debug only off false */

@ini_set('display_errors', 'on');

define('_PS_DEBUG_SQL_', true);

/* Compatibility warning */

define('_PS_DISPLAY_COMPATIBILITY_WARNING_', true);

Share this post


Link to post
Share on other sites

Works with or with out /en/

 

 

Home Page URL:

http://www.example.com/en/

 

CMS page:

http://www.example.c...ontent/about-us

http://www.example.c...t/category/help

 

Category page

http://www.example.com/en/Electronics

 

Product page:

http://www.example.c...i-1450-LMT.html

 

Manufacturer

http://www.example.com/en/mfg/Garmin

 

Supplier

http://www.example.c...n/suplr/Bestbuy

 

 

 

To Install copy the the files in to override folder:

/override/classes/Link.php

/override/classes/Tools.php

 

/override/controllers/CategoryController.php

/override/controllers/CMSController.php

/override/controllers/ManufacturerController.php

/override/controllers/ProductController.php

/override/controllers/SupplierController.php

 

 

 

Than go to Back Office > Tools > Generators > Generate .htaccess file

 

Your all Done!

Seems to work ... not tested yet ... but i have a big big question.

If i do so ... google will keep my links results i ask because google indexed my links with number id.

Tnx in advanced.

Share this post


Link to post
Share on other sites

google bot will get a 301 redirect to the new url the PR should to ported

  • Like 1

Share this post


Link to post
Share on other sites

thanks for your work. I have a small problem. The url for the Backend login can't be found any longer, when using your override files. How can I fix this problem?

Share this post


Link to post
Share on other sites

I would like to thank HA!*!*Y for updaing the module to 0.2. I would like to let everyone know that I finally got it working on my PS site. There could be issues if you had previously installed any of the previous 0.1 versions because there is an issue where there are errors when you try to uninstall 0.1. This is what I did...

 

Note: I was testing things on 1.4.8.2.

 

1) Make sure the following files are original from Prestashop in the classes and controllers folder

 

/classes/Link.php

/classes/Tools.php

/controllers/CategoryController.php

/controllers/CMSController.php

/controllers/ManufacturerController.php

/controllers/ProductController.php

/controllers/SupplierController.php

/config/config.inc.php

 

2) You may delete the following old files in the override directory in the root folder but MAKE SURE you do not just delete the override directory because other modules you use may have created some files in there you need.

 

 

/override/classes/Link.php

/override/classes/Tools.php

/override/controllers/CategoryController.php

/override/controllers/CMSController.php

/override/controllers/ManufacturerController.php

/override/controllers/ProductController.php

/override/controllers/SupplierController.php

 

2) Replace the new files from the 0.2 module in your override directory.

 

3) Regenerate your httaccess file under the Generators settings link. Clear any cookies and cache you have. (Make sure your development site has Force Compile off and Cache Off)

 

Voila it should now work flawlessly :)

 

 

P.S. The CMS pages will no longer have ID #s but there will still be /content/

 

If you are interested in removing /content/ check out the following thread, but after lots of research I found out you really cannot remove it due to Prestashop's infrastructure to differentiate between category URLs. However, you can change "content" to anything else you want.

 

http://www.prestashop.com/forums/topic/60661-solved-friendly-url-how-to-remove-content-from-url/

 

A simple workaround is to set up 301 redirects to specific CMS pages through your hosting cPanel. For example:

 

Set a 301 redirect for http://domain.com/cmspagename to http://domain.com/content/cmpspagename

  • Like 1

Share this post


Link to post
Share on other sites

I would like to thank HA!*!*Y for updaing the module to 0.2. I would like to let everyone know that I finally got it working on my PS site. There could be issues if you had previously installed any of the previous 0.1 versions because there is an issue where there are errors when you try to uninstall 0.1. This is what I did...

 

Note: I was testing things on 1.4.8.2.

 

1) Make sure the following files are original from Prestashop in the classes and controllers folder

 

/classes/Link.php

/classes/Tools.php

/controllers/CategoryController.php

/controllers/CMSController.php

/controllers/ManufacturerController.php

/controllers/ProductController.php

/controllers/SupplierController.php

/config/config.inc.php

 

2) You may delete the following old files in the override directory in the root folder but MAKE SURE you do not just delete the override directory because other modules you use may have created some files in there you need.

 

 

/override/classes/Link.php

/override/classes/Tools.php

/override/controllers/CategoryController.php

/override/controllers/CMSController.php

/override/controllers/ManufacturerController.php

/override/controllers/ProductController.php

/override/controllers/SupplierController.php

 

2) Replace the new files from the 0.2 module in your override directory.

 

3) Regenerate your httaccess file under the Generators settings link. Clear any cookies and cache you have. (Make sure your development site has Force Compile off and Cache Off)

 

Voila it should now work flawlessly :)

 

 

P.S. The CMS pages will no longer have ID #s but there will still be /content/

 

If you are interested in removing /content/ check out the following thread, but after lots of research I found out you really cannot remove it due to Prestashop's infrastructure to differentiate between category URLs. However, you can change "content" to anything else you want.

 

http://www.prestasho...ntent-from-url/

 

A simple workaround is to set up 301 redirects to specific CMS pages through your hosting cPanel. For example:

 

Set a 301 redirect for http://domain.com/cmspagename to http://domain.com/content/cmpspagename

 

Hi guys, here I am again, ready to drive you crazy... :)

Well, I install the last version v.2, delete all the old version files and rewrite with the new ones in each folder, generate the htaccess file but shows me the 500 Internal Server error. If I uninstall the module, everything works fine again (but showing category ID).

I follow your steps Spiffyd, but no luck. Any idea? Running on 1.4.9

Thanks

Share this post


Link to post
Share on other sites

Hi guys!!

 

It seems that PS 1.5 is a bit different... I've tried to install this version and it doesn't work for me.

 

I'm quite new with PS and i tried to follow all steps but i get a "page-not found" error.

 

I've replace all the files in the zip and when i generate the .htaccess (1.5 doesn't have generator button, does it automatically... ) the content is completely different.

 

The original .htacces which works fine is:

 

 

# ~~start~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again

# .htaccess automaticaly generated by PrestaShop e-commerce open-source solution

# http://www.prestashop.com - http://www.prestashop.com/forums

 

<IfModule mod_rewrite.c>

RewriteEngine on

RewriteBase /

RewriteRule ^api/?(.*)$ webservice/dispatcher.php?url=$1 [QSA,L]

 

# Images

RewriteCond %{HTTP_HOST} ^devel.espanaenlamesa.com$

RewriteRule ^([a-z0-9]+)\-([a-z0-9]+)(\-[_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ img/p/$1-$2$3$4.jpg [L]

RewriteCond %{HTTP_HOST} ^devel.espanaenlamesa.com$

RewriteRule ^([0-9]+)\-([0-9]+)(-[0-9]+)?/.+\.jpg$ img/p/$1-$2$3.jpg [L]

RewriteCond %{HTTP_HOST} ^devel.espanaenlamesa.com$

RewriteRule ^([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ img/p/$1/$1$2$3.jpg [L]

RewriteCond %{HTTP_HOST} ^devel.espanaenlamesa.com$

RewriteRule ^([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ img/p/$1/$2/$1$2$3$4.jpg [L]

RewriteCond %{HTTP_HOST} ^devel.espanaenlamesa.com$

RewriteRule ^([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ img/p/$1/$2/$3/$1$2$3$4$5.jpg [L]

RewriteCond %{HTTP_HOST} ^devel.espanaenlamesa.com$

RewriteRule ^([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg [L]

RewriteCond %{HTTP_HOST} ^devel.espanaenlamesa.com$

RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg [L]

RewriteCond %{HTTP_HOST} ^devel.espanaenlamesa.com$

RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg [L]

RewriteCond %{HTTP_HOST} ^devel.espanaenlamesa.com$

RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg [L]

RewriteCond %{HTTP_HOST} ^devel.espanaenlamesa.com$

RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg [L]

RewriteCond %{HTTP_HOST} ^devel.espanaenlamesa.com$

RewriteRule ^c/([0-9]+)(\-[_a-zA-Z0-9-\.*]*)(-[0-9]+)?/.+\.jpg$ img/c/$1$2$3.jpg [L]

RewriteCond %{HTTP_HOST} ^devel.espanaenlamesa.com$

RewriteRule ^c/([a-zA-Z-]+)(-[0-9]+)?/.+\.jpg$ img/c/$1$2.jpg [L]

 

 

# Dispatcher

RewriteCond %{REQUEST_FILENAME} -s [OR]

RewriteCond %{REQUEST_FILENAME} -l [OR]

RewriteCond %{REQUEST_FILENAME} -d

RewriteCond %{HTTP_HOST} ^devel.espanaenlamesa.com$

RewriteRule ^.*$ - [NC,L]

RewriteCond %{HTTP_HOST} ^devel.espanaenlamesa.com$

RewriteRule ^.*$ index.php [NC,L]

</IfModule>

 

#If rewrite mod isn't enabled

ErrorDocument 404 /index.php?controller=404

 

# ~~end~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again

 

After installing your files, the new .htaccess content is:

 

 

# .htaccess automaticaly generated by PrestaShop e-commerce open-source solution

# WARNING: PLEASE DO NOT MODIFY THIS FILE MANUALLY. IF NECESSARY, ADD YOUR SPECIFIC CONFIGURATION WITH THE HTACCESS GENERATOR IN BACK OFFICE

# http://www.prestashop.com - http://www.prestashop.com/forums

 

 

<IfModule mod_rewrite.c>

# URL rewriting module activation

RewriteEngine on

 

# URL rewriting rules

RewriteRule ^api/?(.*)$ /webservice/dispatcher.php?url=$1 [QSA,L]

</IfModule>

 

# Catch 404 errors

ErrorDocument 404 /404.php

 

I can see in the front-end than urls have changed (no id) but every link on the page returns a "page-not found"

 

Any ideas of what can it be happening?

 

Many thanks!!

Share this post


Link to post
Share on other sites

I installed this module on prestashop 1.4.8.3, it works fine!

 

Just one problem with CATEGORY URLs rewrite:

 

After installing this module, Category pages display correctly only with no slash "/" at the end.

 

 

www.mysite/category-favourite - displays correctly

www.mysite/category-favourite/ - displays incorrectly, does not show any products from this category.

 

This problem only seems to be with Category URLs.

I've tested CMS pages, they all get redirected to the URL with "/".

Edited by varen (see edit history)

Share this post


Link to post
Share on other sites

I installed this module on prestashop 1.4.8.3, it works fine!

 

Just one problem with CATEGORY URLs rewrite:

 

After installing this module, Category pages display correctly only with no slash "/" at the end.

 

 

www.mysite/category-favourite - displays correctly

www.mysite/category-favourite/ - displays incorrectly, does not show any products from this category.

 

This problem only seems to be with Category URLs.

I've tested CMS pages, they all get redirected to the URL with "/".

 

Can anyone help?

 

After this module installation, when a Category name is written with a slash "/" at the end, I get an error:

 

There is 1 error :

  • Missing category ID

 

 

This doesn't happen with CMS pages - they get redirected to a version with "/" at the end.

Share this post


Link to post
Share on other sites

Can anyone help?

 

After this module installation, when a Category name is written with a slash "/" at the end, I get an error:

 

 

There is 1 error :

  • Missing category ID

 

 

This doesn't happen with CMS pages - they get redirected to a version with "/" at the end.

 

 

 

I found the solution (this works for my Prestashop version 1.4.8.3).

Now all my category pages with "/" at the end get redirected to category pages without "/" at the end. No more messages "Missing category ID.

 

Here what you need to do if you get similar problem:

 

if you find that there is an error with the category id

There is 1 error :

Missing category ID

 

you will have to do the fallowing

 

Change in /classes/Tools.php (just remove the "+" sign before the filename)

FROM

 

//remove link id by Ha!*!*y

$tab['RewriteEngine']['content_no_id'][] = 'RewriteCond %{REQUEST_FILENAME} !-f';

$tab['RewriteEngine']['content_no_id'][] = 'RewriteCond %{REQUEST_FILENAME} !-d';

$tab['RewriteEngine']['content_no_id'][] = 'RewriteRule ^([a-zA-Z0-9-]*)(/[a-zA-Z0-9-]*)+ category.php?category_name_seo=$1&noredirect=1 [QSA,L]';

$tab['RewriteEngine']['content_no_id'][] = 'RewriteCond %{REQUEST_FILENAME} !-f';

$tab['RewriteEngine']['content_no_id'][] = 'RewriteCond %{REQUEST_FILENAME} !-d';

$tab['RewriteEngine']['content_no_id'][] = 'RewriteRule ^([a-zA-Z0-9-]*)+ category.php?category_name_seo=$1 [QSA,L]';

//remove link id by Ha!*!*y

TO

 

 

//remove link id by Ha!*!*y

$tab['RewriteEngine']['content_no_id'][] = 'RewriteCond %{REQUEST_FILENAME} !-f';

$tab['RewriteEngine']['content_no_id'][] = 'RewriteCond %{REQUEST_FILENAME} !-d';

$tab['RewriteEngine']['content_no_id'][] = 'RewriteRule ^([a-zA-Z0-9-]*)(/[a-zA-Z0-9-]*) category.php?category_name_seo=$1&noredirect=1 [QSA,L]';

$tab['RewriteEngine']['content_no_id'][] = 'RewriteCond %{REQUEST_FILENAME} !-f';

$tab['RewriteEngine']['content_no_id'][] = 'RewriteCond %{REQUEST_FILENAME} !-d';

$tab['RewriteEngine']['content_no_id'][] = 'RewriteRule ^([a-zA-Z0-9-]*) category.php?category_name_seo=$1 [QSA,L]';

//remove link id by Ha!*!*y

 

Add at the end of /config/config.inc.php

 

if (Tools::getValue('category_name_seo'))

{

$id_category = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('

SELECT `id_category`

FROM `'._DB_PREFIX_.'category_lang`

WHERE `link_rewrite` = \''.Tools::getValue('category_name_seo').'\'');

$_GET['id_category'] = $id_category;

}

 

 

and regenerate you htaccess

Share this post


Link to post
Share on other sites

Hi,

 

is there a fix for Prestashop 1.5 for this code?

 

I've had a look and it seems the generateHtaccess() method in overrides/classes/Tools.php needs to be updated so that it properly writes the .htaccess file for Prestashop 1.5.

 

I've had a look at this myself but i'm new to Prestashop and can't figure it out.

Share this post


Link to post
Share on other sites

Man/ Girl, you are unbelievable!

 

Works like a charm for me and you don't sell your awesome stuffs for even a dime :)

Share this post


Link to post
Share on other sites

One question though, I don't need to remove the IDs from URLs for products, so how do I exclude products?

 

This is because

  • I believe looking up for products by "link_rewrite" will takes much longer than by ID
  • There are way to many products and most of traffic would be on products' pages I suppose - this will cause a burden on my servers
  • There are too many products that the chance of having products with the same name is actually quite high
  • Some mentioned that the IDs shouldn't have any SEO impact has Pretashop's default friendly URL is good enough for SEO and I agree.

Do you have any thoughts on my above points?

Edited by Eric Nguyen (see edit history)

Share this post


Link to post
Share on other sites

@ joannaleng

 

Your site just loads fine and is working.

 

ysco..

Share this post


Link to post
Share on other sites

hey, thanks!

 

i just realised i uploaded the wrong files to the wrong place and managed to have it fix.

 

thx for the reply ysco!

Share this post


Link to post
Share on other sites

I found another problem after overriding URLs without ID numbers.

 

 

When I click on a link "Update Address" or "Change Address"

throught "My Account" or while placing an order, I get an empty page, and an error:

 

 

Uncaught ReferenceError: countries is not defined statesManagement.js:29

 

Line 29, file: your_theme/js/tools/stateManagement.js

 

function updateState(suffix)

{

$('select#id_state'+(suffix !== undefined ? '_'+suffix : '')+' option:not(:first-child)').remove();

var states = countries[$('select#id_country'+(suffix !== undefined ? '_'+suffix : '')).val()];

 

Uncaught ReferenceError: countries is not defined

if(typeof(states) != 'undefined')

{

$(states).each(function (key, item){

$('select#id_state'+(suffix !== undefined ? '_'+suffix : '')).append('<option value="'+item.id+'"'+ (idSelectedCountry == item.id ? ' selected="selected"' : '') + '>'+item.name+'</option>');

});

$('p.id_state'+(suffix !== undefined ? '_'+suffix : '')+':hidden').slideDown('slow');

}

else

$('p.id_state'+(suffix !== undefined ? '_'+suffix : '')).slideUp('fast');

}

 

 

Could the author of this post to look into this and fix it? Thanks.

Edited by varen (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites

Strange problem after installing. Not all my products have EAN codes and they work fine now with this module but the ones I have filled in the EAN code don't work. Can't find them. 404

 

 

Example: go to http://www.bruinenfi...nl/hometrainers

then choose one.........nothing will come

 

Example: got to http://www.bruinenfi...r.nl/speedbikes

then chosse one......and it works

 

When I remove a EAN code it is comming up the right way

 

My site is still under construction and I have only filled in the EAN codes under the category "hometrainers" and not in the other ones yes.

 

What could it be......followed the instructions. I am using 1.4.9.0

Edited by misa (see edit history)

Share this post


Link to post
Share on other sites

It works great with Prestashop 1.4.7.3. But I have found some duplicate content at the Category page:

 

For Example

 

http://www.example.com/en/Electronics

 

http://www.example.com/en/Elektronik (Elektronik is the friendly URL for the 2nd language)

 

http://www.example.com/Electronics

 

..shows the same content. I am not well-practised with htaccess. It would be nice, if you or somebody else has a solution

to get off the dc. Thanks and greetings.

Edited by CroMag (see edit history)

Share this post


Link to post
Share on other sites

this is so fregen cool. you guys know what this means right? We can now easily switch over from Apache to Nginx. You are SO cool! thank you for this. I'm going to download it and try it out.

 

At the moment I'm creating like 2000 rewrite rules. Terriable.. :(

Share this post


Link to post
Share on other sites

HA!*!*Y I have one question.

 

what should I do to have at the end of category url slash.

ex. www.homepage.com/category-yadayada/

Share this post


Link to post
Share on other sites

Seems it doens¡t work for Prestashop 1.4.8.3

Blank page, nothing appears.

Share this post


Link to post
Share on other sites

Blank page, nothing appears.

 

regenerete .htaccess

 

with ftp client go to folder /tools/smarty/compile and delete everything except index.php

 

refresh site and at the end, optionally delete your browser history.

Share this post


Link to post
Share on other sites

this works in version 1.5.1.0?

 

Thanks

Really, does it work on Prestashop 1.5.x, I have version 1.5.2, tried to install according to instructions, had some problems, needed to return settings back. Please answer me:)

Share this post


Link to post
Share on other sites

regenerete .htaccess

 

with ftp client go to folder /tools/smarty/compile and delete everything except index.php

 

refresh site and at the end, optionally delete your browser history.

Done and still it goes with blank page, both B.Office and F.O

Share this post


Link to post
Share on other sites

Done and still it goes with blank page, both B.Office and F.O

 

have you tried delete browser cache and which presta version do you have? mine is 1.4.9.0.

and, have you read instruction. first time installing v.1.2 I have failed reading manual.

Edited by wizeazz (see edit history)

Share this post


Link to post
Share on other sites

have you tried delete browser cache and which presta version do you have? mine is 1.4.9.0.

and, have you read instruction. first time installing v.1.2 I have failed reading manual.

Yes, I've tried.

1.4.8.3

Share this post


Link to post
Share on other sites

Yes, I've tried.

1.4.8.3

 

try to restore original files, delete cache and try once more installing/uploading url rewrite.

if you haven't modified your presta it should work, coz I have modified mine a lot and it works just fine.

 

PS- I've got blank page afte first install v 1.2 because I haven't read manual and have uploaded files to wrong folder.

Edited by wizeazz (see edit history)

Share this post


Link to post
Share on other sites

This is awesome it for realz works on 1.49 (: thanks youre the bestest!! <3Kristen

 

ps - now if we can jus get rid of the gay .html extension!!

Share this post


Link to post
Share on other sites

is there this thing also for prestashop 1.5.3 ? when I tested it, the shop didnt work

Share this post


Link to post
Share on other sites

Great job HA!*!*Y!!

I'm using your mod in 1.4.7.3 and it's working ok but I found a problem. Maybe is only with my template but in product view I have a link to the manufacturer of this product that doesn't works.

Without your mod you are in "website/"product-ID"_"product-name".html and the link goes to "website/"manufacturer-ID"_"product-name" and redirects tu "website/"manufacturer-ID"_"manufacturer-name".html

 

 

You can see the problem in my website: http://cookedinbarce.../crash-002.html if you click on "Cooked" under "Referencia:

CRASH 002"

 

Thanks!

 

 

 

Sergi.

Edited by Phoenix_3D (see edit history)

Share this post


Link to post
Share on other sites

Does anyone have a solution for inserting manufacturer name into the URL? ex. /cell-phone/apple-iphone5

Share this post


Link to post
Share on other sites

Just wanted to say.. you are amazing!

Makes my URL's look soo much cleaner and more professional!

 

Cannot begin to thing WHY prestashop designed the URL to have an id code?

 

 

thankyou, thankyou, thankyou

Share this post


Link to post
Share on other sites

id code need bc if you have category like:

 

women/tights

chilldren/tights

 

And you will have same link for tights category:

 

site.com/tights and you will have a lot of problems with same category names

Share this post


Link to post
Share on other sites

For some reason my images are gone? Is this normal?

Because it strips my id's also the image id's are stripped but now my images arent visible?

What is the solution?

Edited by beekhouse (see edit history)

Share this post


Link to post
Share on other sites

Strange problem after installing. Not all my products have EAN codes and they work fine now with this module but the ones I have filled in the EAN code don't work. Can't find them. 404

 

 

Example: go to http://www.bruinenfi...nl/hometrainers

then choose one.........nothing will come

 

Example: got to http://www.bruinenfi...r.nl/speedbikes

then chosse one......and it works

 

When I remove a EAN code it is comming up the right way

 

Hi guys, i'm having same problem than this guy "misa" posted some months ago and no one solved it, the products with ean return 404 error :

http://www.luxuryspirits.es/es/pagina-no-encuentra?product_name_seo=armand-de-brignac-botella-verde-edicion-limitada-2013-0000001

 

Could someone tell me how to solve this??, i really need to fix this.

The products without ean work correctly but the products with ean don't work.

 

Thanks.

Share this post


Link to post
Share on other sites

I decided to strip the category from product url in links.php override to avoid duplication and be able to change category to products whenever needed.

 

if (isset($id_product->category) AND !empty($id_product->category) AND $id_product->category != 'home')

$link .= '';

 

 

Seems to work fine on 1.4.4 I am wondering why prestashop do not remove id by default? I remember I read in some older post that id should not be removed any idea why?

Share this post


Link to post
Share on other sites
I decided to strip the category from product url in links.php override to avoid duplication and be able to change category to products whenever needed. if (isset($id_product->category) AND !empty($id_product->category) AND $id_product->category != 'home') $link .= ''; Seems to work fine on 1.4.4 I am wondering why prestashop do not remove id by default? I remember I read in some older post that id should not be removed any idea why?

 

 

 

Works for 1.4.9 prestashop, but....If you decide to strip the category from product URL as per comment above, consider this: after testing my website for 1 day I must say, product pages got very slow. It's not worth it.

Edited by varen (see edit history)

Share this post


Link to post
Share on other sites

Can no one tell me why all my product images are broken after generating htaccess file?

  • Like 1

Share this post


Link to post
Share on other sites

hello, the images on my product pages are gone... any ideas?

Share this post


Link to post
Share on other sites

Hi, how can i remove the .html of the product link?, if i edit the link.php file removing the .html at the end of the $link, i get an error of page not found.

 

I saw that .htacces file is doing rewriterules from ()*.html to $product.php?id_product = $1............

 

I think that i can't remove the .html from products since HAY is using the .html in products like filter for get the content of the products.

 

Example:

 

www.asdasd.com/categpry/product.html ---> www.asdasd.com/category/product.php?id_product=5

 

RewriteRule ^([0-9]+)\-[a-zA-Z0-9-]*\.html /product.php?id_product=$1 [QSA,L]

 

i have rules like that at this moment.

 

Like i said i can check that we are using .html for products and only for it.

 

If i try to remove the .html of the rule

 

RewriteRule ^([0-9]+)\-[a-zA-Z0-9-]* /product.php?id_product=$1 [QSA,L]

 

We'll have a problem since when we find anything, like www.asdasd.com/qwe/ert this will try to get product.php?id_product=qwe

 

and we don't want it for all pages, we only want it for product page.

 

Greetings.

Share this post


Link to post
Share on other sites

Hey! It works great with removing the IDs from URLs, thank you very much!

 

But now there's an error with all the images. They are still there, PS just does not want to show them. I guess it loses the track of images because of the removed ID. Did someone find a solution for this? Will be highly appreciated!

Share this post


Link to post
Share on other sites

Hi

 

This is great has only managed to get it to work on ps 1.3.1

 

There is no change on my site and would really like to get it working

 

Many Thanks

 

Gary

Share this post


Link to post
Share on other sites

hi

please help me , remove slash from end url & categories

www.iroption.com/shop/ change to www.iroption.com/shop

www.iroption.com/shop/option-206/ change to www.iroption.com/shop/option-206

Share this post


Link to post
Share on other sites

Thanks for sharing

 

I had a small issue with this - I had a manufacturer named "B&B" and the "&" made some issue. I fixed it like this:

<?php
/*
* 2013 Ha!*!*y
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* It is available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
*
* DISCLAIMER
* This code is provided as is without any warranty.
* No promise of being safe or secure
*
*  @author      Ha!*!*y <ha99ys@gmail.com>
*  @copyright   2012-2013 Ha!*!*y
*  @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  @code sorce: http://prestashop.com
*/

class ManufacturerController extends ManufacturerControllerCore
{
	public function init()
	{
		if (Tools::getValue('manufacturer_rewrite'))
		{
			$name_manufacturer = str_replace('-', '%', Tools::getValue('manufacturer_rewrite'));

			//
			// TODO:: need to core update Prestashop code and 
			// DB for link_rewrite for manufacturers
			// Should we use the Mysql FullText Index Search ??
			//
			$sql = 'SELECT m.`id_manufacturer` 
				FROM `'._DB_PREFIX_.'manufacturer` m
				LEFT JOIN `'._DB_PREFIX_.'manufacturer_shop` s ON (m.`id_manufacturer` = s.`id_manufacturer`)
				WHERE REPLACE(m.`name`,"&","") LIKE \''.$name_manufacturer.'\'';

			if (Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP)
			{
				$sql .= ' AND s.`id_shop` = '.(int)Shop::getContextShopID();
			}
			
			$id_manufacturer = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);

			if($id_manufacturer > 0)
			{
				$_GET['id_manufacturer'] = $id_manufacturer;
				$_GET['noredirect'] = 1;
			}
			else
			{
				//TODO: Do we need to send 404?
				header('HTTP/1.1 404 Not Found');
				header('Status: 404 Not Found');
			}
		}
		parent::init();
	}
}

I have another issue. I keep getting BOwarnings of duplicates but its not duplicates, its product variants. So in this I think need to be fixed something in the sql query. A fix would be very welcome :)

	public function getContent()
	{
		$output = '';

		if (Tools::isSubmit('submitCleanURLS'))
		{
			
		}

		//Advanced Parameters > Performance > Clear Smarty cache 
		//On some versions you have to disable Cache save than open your shop home page than go back and enable it.<br/><br/>';

		$sql = 'SELECT * FROM `'._DB_PREFIX_.'product_lang`
				WHERE `link_rewrite`
					IN (SELECT `link_rewrite` FROM `'._DB_PREFIX_.'product_lang`
					GROUP BY `link_rewrite`, `id_lang`
					HAVING count(`link_rewrite`) > 1)';

		if (Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP)
		{
			$sql .= ' AND `id_shop` = '.(int)Shop::getContextShopID();
		}

		if ($results = Db::getInstance()->ExecuteS($sql))
		{
			$output .= 'You need to fix duplicate URL entries<br/>';
			foreach ($results AS $row)
			{
				$output .= $row['name'].' ('.$row['id_product'] .') - '. $row['link_rewrite'].'<br/>';
			}
		}
		else
		{
			$output .= 'Nice you don\'t have any duplicate URL entries.';
		}

		return $output;
	}

Share this post


Link to post
Share on other sites

Works with or with out /en/

 

 

Home Page URL:

http://www.example.com/en/

 

CMS page:

http://www.example.c...ontent/about-us

http://www.example.c...t/category/help

 

Category page

http://www.example.com/en/Electronics

 

Product page:

http://www.example.c...i-1450-LMT.html

 

Manufacturer

http://www.example.com/en/mfg/Garmin

 

Supplier

http://www.example.c...n/suplr/Bestbuy

 

 

 

To Install copy the the files in to override folder:

/override/classes/Link.php

/override/classes/Tools.php

 

/override/controllers/CategoryController.php

/override/controllers/CMSController.php

/override/controllers/ManufacturerController.php

/override/controllers/ProductController.php

/override/controllers/SupplierController.php

 

 

 

Than go to Back Office > Tools > Generators > Generate .htaccess file

 

Your all Done!

 

for Prestashop 1.5: http://www.prestashop.com/forums/index.php?/topic/204935-override-friendly-urls-without-id-number-for-v15/page__view__findpost__p__1011168

thanks worked fine with 1.4.7

Share this post


Link to post
Share on other sites

hello, can you update to also remove the ean13, please?

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More