servpro2 Posted February 12, 2009 Share Posted February 12, 2009 Ok, I am trying to remove the category and product ID from the friendly urls. I have Friendly URLs enabled. Right now:http://www.mysite.com/3-computershttp://www.mysite.com/4-dell-lcdI want it to be:http://www.mysite.com/computershttp://www.mysite.com/lcds/dell-lcd(LCDs is the category name and dell lcd is the product)Can someone help me with this? Link to comment Share on other sites More sharing options...
Damien Metzger Posted February 12, 2009 Share Posted February 12, 2009 There's only one clean way to do it: you have to put every single category link in your htaccess... 1 Link to comment Share on other sites More sharing options...
servpro2 Posted February 12, 2009 Author Share Posted February 12, 2009 There's only one clean way to do it: you have to put every single category link in your htaccess... How would I do that? Can you give me a sample line?Thanks Link to comment Share on other sites More sharing options...
Damien Metzger Posted February 12, 2009 Share Posted February 12, 2009 YopRewriteRule ^computers$ category.php?id_category=3 [QSA,L,E]RewriteRule ^lcds/dell-lcd$ category.php?id_category=4 [QSA,L,E] Link to comment Share on other sites More sharing options...
servpro2 Posted February 12, 2009 Author Share Posted February 12, 2009 thanks alot.Do I need to modify core files to update the linking? I got it to work, but the menu still links to the old way. Link to comment Share on other sites More sharing options...
Damien Metzger Posted February 12, 2009 Share Posted February 12, 2009 The menu is a module, so you can just override the module template by copying /modules/blockcategories/*.tpl in /themes/yourtheme/modules/blockcategories/*.tpl and remove the id in the links. Link to comment Share on other sites More sharing options...
chuko Posted February 12, 2009 Share Posted February 12, 2009 Pierre-Yves wrote a nice solution. Thanks, Pierre-Yves! It is a hack in that it messes with the prestashop core files, but that's what one must do for now. There are some other issues you might run into.There are three relevant files on the page:1) The module that automatically sets up the .htaccess file - urlrewritingplus_1_2.zip2) The modifications to link.php - be careful here as the attached file is for prestashop 1.0, not 1.1 - however, the additions to the file still work fine as written3) There is also in the thread the module translated (mostly) into english Link to comment Share on other sites More sharing options...
sidro Posted February 20, 2009 Share Posted February 20, 2009 would you explain with more details how it's done ? i read that post but i;m not so good in french.i tested but still no changes made. same as before.prestashop v1.1in blockcategories i can find that line which makes that change Link to comment Share on other sites More sharing options...
chuko Posted February 22, 2009 Share Posted February 22, 2009 Some instructions in English for using the urlrewritingplus module.1) Download the file urlrewritingplus_1_2.zip from the thread, and unzip to the main modules directory2) Download urlrewritingplus.php from the fourth page. This is the same module translated to English. Replace the old urlrewritingplus.php in the modules/urlrewritingplus directory with this one.3) Download link.php from the first page, but don't use this one directly. Instead,4) Open up the file classes/link.php and replace the functions "public function getProductLink" and "public function getCategoryLink" with those same functions from the link.php file you downloaded.5) Go into the admin panel. Under modules, install and configure urlrewritingplus to Create the Rules for all products and categories, and then to Generate the Rules. You might want to backup your .htaccess file before doing this.Hope that's helpful! Link to comment Share on other sites More sharing options...
sidro Posted February 22, 2009 Share Posted February 22, 2009 Works on v1.1 final for products and categories but not for the cms !!! when clicking on about-us for exemple the page returns a error not found on server.any solutions ?Cheers and good luck ! Link to comment Share on other sites More sharing options...
chuko Posted February 22, 2009 Share Posted February 22, 2009 I haven't tried to change the url rewrite for anything but the products and categories, but I imagine that you could extend the solutions by modifying the getCMSLink function in link.php just as you modified getCategoryLink and getProductLink (except that it ought to be more simple) and adding a new button to the urlrewritingplus module to support CMS. Same goes for getSupplierLink, getManufacturerLink, and so on.Let us know if you have some success extending it! Link to comment Share on other sites More sharing options...
chuko Posted February 23, 2009 Share Posted February 23, 2009 I didn't understand what you were asking the first time, but here's an actual answer. To fix the error on the cms links when using the urlrewritingplus module:Go to the admin panel. Click on modules and configure for urlrewritingplus.At the bottom you'll see "File. Htaccess default". Click on the text field to edit.Add this line: RewriteRule ^content/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ cms.php?id_cms=$1 [QSA,L,E]Click on the button, "Save the file content .htaccess default".Click on "Generate Rules"That should do it. It just gives you the normal Prestashop Friendly URLs for the cms, but it does work... Link to comment Share on other sites More sharing options...
sidro Posted February 23, 2009 Share Posted February 23, 2009 sorry to inform that it doesn't work that way. seems that i have to modify the link.php at the "public function getCMSLink"with the standard modfication as you explain it to me works fine for products and categories.butwhen i click on a cms returns server error page not found on server or resticted.i do not what to insert a new tab in the module.i just want to make it work without errors.cheers ! Link to comment Share on other sites More sharing options...
Paul Bogdan Posted March 15, 2009 Share Posted March 15, 2009 The menu is a module, so you can just override the module template by copying /modules/blockcategories/*.tpl in /themes/yourtheme/modules/blockcategories/*.tpl and remove the id in the links. I don't know what you say 'couse in my case there's no modules folder in theme directoryI have the same issue with the category number, I don't found anything to remove that number.I'm using prestashop 1.0 Link to comment Share on other sites More sharing options...
Paul Bogdan Posted March 15, 2009 Share Posted March 15, 2009 thanks alot.Do I need to modify core files to update the linking? I got it to work, but the menu still links to the old way. did you fixed it? can you please explain what the procedure is?thanks Link to comment Share on other sites More sharing options...
kreasta Posted September 26, 2009 Share Posted September 26, 2009 i'm interested also Link to comment Share on other sites More sharing options...
Sanis Posted February 15, 2010 Share Posted February 15, 2010 Iam rewriting urls manually while Pierre-Yves solution appears to be outdated.I cant figure is how to remove id from tpl file as suggested below. The menu is a module, so you can just override the module template by copying /modules/blockcategories/*.tpl in /themes/yourtheme/modules/blockcategories/*.tpl and remove the id in the links. What would be required code modification? Link to comment Share on other sites More sharing options...
j_dk Posted April 16, 2010 Share Posted April 16, 2010 Any one found the solution? Link to comment Share on other sites More sharing options...
Clooner Posted April 20, 2010 Share Posted April 20, 2010 Does anyone have a solution already? I need really clean urls! I already found out that when I copy the prestashop generated .htaccess into the url rewriting plus module default .htacces textarea it works better. Link to comment Share on other sites More sharing options...
Masino Sinaga Posted May 5, 2010 Share Posted May 5, 2010 Any one found the solution? Yes. Please check this article:How to Remove Category ID from URL of PrestaShop version 1.2.5 Link to comment Share on other sites More sharing options...
bluedolphin87 Posted January 15, 2011 Share Posted January 15, 2011 YopRewriteRule ^computers$ category.php?id_category=3 [QSA,L,E]RewriteRule ^lcds/dell-lcd$ category.php?id_category=4 [QSA,L,E] I add this in my .htacces and i also have modified file link.phpbut it shows 500 internal server error.any solution? i'm working on this in my local server, not in any hosting.Thanks Link to comment Share on other sites More sharing options...
RickieSee Posted November 29, 2011 Share Posted November 29, 2011 Bump. Any solution for 1.4.*? Link to comment Share on other sites More sharing options...
dramony Posted January 11, 2012 Share Posted January 11, 2012 Bump. Any solution for 1.4.*? i also want a solution to this. Link to comment Share on other sites More sharing options...
mscat Posted January 11, 2012 Share Posted January 11, 2012 Badly need a solution for v.1.4.. actually everyone does.. Moderators.. please help!!! Thanks! Link to comment Share on other sites More sharing options...
subulica Posted March 28, 2012 Share Posted March 28, 2012 i still waiting for a solution in 1.4.7 Link to comment Share on other sites More sharing options...
subulica Posted March 28, 2012 Share Posted March 28, 2012 I add this in my .htacces and i also have modified file link.php but it shows 500 internal server error. any solution? i'm working on this in my local server, not in any hosting. Thanks it works for me but only in site but my old links from google wont work Link to comment Share on other sites More sharing options...
Sobolev Posted September 18, 2014 Share Posted September 18, 2014 Is there a solution for Prestashop 1.6? Link to comment Share on other sites More sharing options...
Sobolev Posted January 9, 2015 Share Posted January 9, 2015 Could you tell what plugin is needed for this? 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