Jump to content

IIS Mod-ReWrite Pro and PrestaShop fix


Recommended Posts

Rename your htaccess.txt to .htaccess (use cmd prompt)
Grant permission on .htaccess to IIS_WPG for IIS 6 or IIS_IUSRS for IIS 7
Edit .htaccess so it contains only this:

# URL rewriting module activation
RewriteEngine on

# URL rewriting rules
RewriteRule ^([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ product.php?id_product=$2$4 [L]
RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ product.php?id_product=$1$3 [L]
RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ category.php?id_category=$1 [QSA,L]
RewriteRule ^content/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ cms.php?id_cms=$1 [QSA,L]
RewriteRule ^([0-9]+)__([a-zA-Z0-9-]*)(.*)$ supplier.php?id_supplier=$1$3 [QSA,L]
RewriteRule ^([0-9]+)_([a-zA-Z0-9-]*)(.*)$ manufacturer.php?id_manufacturer=$1$3 [QSA,L]



Enable Friendly URLs in Prestashop Admin
Poof!

I like IIS Mod-ReWrite pro, it was fast and easy to set up and works great with Joomla. Not cheap though, $150 per server, but if you struggle with another one for more than an hour or two you've already burned that in time, so I think it's worth it given how easily it works.

Link to comment
Share on other sites

  • 1 month later...

All URLs are correctly parsed only the images dont load... i notice in your rewrite rules you dont include anything about images...could you please tell me how do you handle that ?

this is my rule for .img

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

but cant make it work!

anybody has any ideas?

Link to comment
Share on other sites

Url rewriting is one of the biggest problem with prestashop at the moment. If it's wrong and is rewriting bad urls, google will index them and it will be very annoying to fix (you lose your rankings).

Come on guys! fix it ASAP please!

As for the images, does this not work for you dennis:

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]+)(\-[_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)\.jpg$ /img/c/$1$2.jpg [L,E]

Link to comment
Share on other sites

Thanks for your reply mr. c !!

I made it work finally last night :D

Specifications : O/S: Windows Server 2003
Web Server: IIS 5.0

I know its the worst setup you could find..and i wouldnt recommend it to anyone...but this is what i was given at my job..and i dont have the rights to change it..hopefully when the current contract ends..fingers crossed we will integrate to Ubuntu wth Apache and make our lives happier!!!

I used the Ionic Rewrite module..but with not much success. Then i purchased the IIS-Mod rewrite module from http://www.micronovae.com/ModRewrite/ModRewrite.html

..and here is my Rewrite rules:

RewriteRule ^([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.jpg$ /img/p/$1-$2$3.jpg[L]
RewriteRule ^([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.jpg$ /img/c/$1$2.jpg [L]
RewriteRule ^([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ product.php?id_product=$2$4 [L]
RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ product.php?id_product=$1$3 [L]
RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ category.php?id_category=$1 [QSA,L]
RewriteRule ^content/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ cms.php?id_cms=$1 [QSA,L]
RewriteRule ^([0-9]+)__([a-zA-Z0-9-]*)(.*)$ supplier.php?id_supplier=$1$3 [QSA,L]
RewriteRule ^([0-9]+)_([a-zA-Z0-9-]*)(.*)$ manufacturer.php?id_manufacturer=$1$3 [QSA,L]

Best Regards to all

dennis

Link to comment
Share on other sites

  • 4 years later...
×
×
  • Create New...