codeblue Posted December 9, 2011 Share Posted December 9, 2011 I have been trying to get URL rewrite working on lighttpd for days, nothing that other users posted worked, but I FINALLY got it. Put the following in your lighttpd.conf at the bottom if you dont have any vhosts but if u have vhosts put it inside the vhost statement. url.rewrite-once = ( "^/([a-z0-9]+)\-([a-z0-9]+)(\-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-]*\.jpg$" => "/img/p/$1-$2$3.jpg", "^/c/([0-9]+)(\-[_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)\.jpg$" => "/img/c/$1$2.jpg", "^/([0-9]+)\-([0-9]+)/[_a-zA-Z0-9-]*\.jpg$" => "/img/p/$1-$2.jpg", "^/([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$" => "/img/p/$1/$1$2.jpg", "^/([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$" => "/img/p/$1/$2/$1$2$3.jpg", "^/([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$" => "/img/p/$1/$2/$3/$1$2$3$4.jpg", "^/([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$" => "/img/p/$1/$2/$3/$4/$1$2$3$4$5.jpg", "^/([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$" => "/img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6.jpg", "^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$" => "/img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7.jpg", "^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$" => "/img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8.jpg", "^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$" => "/img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9.jpg", "^/lang-([a-z]{2})/([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(\?(.*))?" => "/product.php?id_product=$3&isolang;=$1$6" , "^/lang-([a-z]{2})/([0-9]+)\-([a-zA-Z0-9-]*)\.html(\?(.*))?" =>"/product.php?id_product=$2&isolang;=$1&$4", "^/lang-([a-z]{2})/content/([0-9]+)\-([a-zA-Z0-9-]*)(\?(.*))?" =>"/cms.php?id_cms=$2&isolang;=$1&$4", "^/lang-([a-z]{2})/([0-9]+)\-([a-zA-Z0-9-]*)(\?(.*))?" =>"/category.php?id_category=$2&isolang;=$1&$5" , "^/([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(\?(.*))?" => "/product.php?id_product=$2&$5" , "^/([0-9]+)\-([a-zA-Z0-9-]*)\.html(\?(.*))?" =>"/product.php?id_product=$1&$4", "^/([0-9]+)\-([a-zA-Z0-9-]*)(\?(.*))?" =>"/category.php?id_category=$1&$4" , "^/content/([0-9]+)\-([a-zA-Z0-9-]*)(\?(.*))?" =>"/cms.php?id_cms=$1&$4" , "^/([0-9]+)__([a-zA-Z0-9-]*)(\?(.*))?" =>"/supplier.php?id_supplier=$1&$4" , "^/([0-9]+)_([a-zA-Z0-9-]*)(\?(.*))?" =>"/manufacturer.php?id_manufacturer=$1&$4", "^/lang-([a-z]{2})/(\?(.*))?" => "/index.php?isolang=$1&$2" ) 1 Link to comment Share on other sites More sharing options...
idseo Posted December 10, 2011 Share Posted December 10, 2011 Thank You very much work for me Link to comment Share on other sites More sharing options...
mtleng Posted January 24, 2012 Share Posted January 24, 2012 No surprise, didn't work for me on latest release (1.4.6.2). This is inherently a never ending problem because the .htaccess file has to be generated and is therefore always going to be fluctuating. Unless Prestashop decides to either [a] support generation of Lighty rules or redesign their SEO mechanism to support a more static .htaccess file, anybody using Lighty will be destined to continual maintenance of their Lighty conf file, plus manual updating anytime they decide to change some SEO parameters. Anything found on the web, like in this post, may kinda work if you're lucky, but more likely will not work at all or not work at places you just didn't notice. This is because the rewrite rules are going to vary too much from one shop to another. Anyways, since I doubt [a] or is going to happen anytime soon, I would suggest generating the .htaccess file anytime you update Prestashop or make changes to SEO parms, and then manually create/update your Lighty conf file accordingly. Of course, you'll have to know how to make the conversion from Apache rules to Lighty rules... good luck! Link to comment Share on other sites More sharing options...
guidoakd Posted January 26, 2013 Share Posted January 26, 2013 Where is the lighttpd to edit? Link to comment Share on other sites More sharing options...
brotherik Posted March 25, 2014 Share Posted March 25, 2014 sorry for my english I think than url friendly with lighttp in the last version on prestashop don´t work. Someone has found a solution. thanks you advance!! Link to comment Share on other sites More sharing options...
PavelPashuk Posted July 20, 2014 Share Posted July 20, 2014 HELP ME! I have Prestashop 1.6 and installed ligtthpd. I wrote all rewrite rules, but my site is not avalable. What did i forgot? Link to comment Share on other sites More sharing options...
patukos Posted September 3, 2014 Share Posted September 3, 2014 I have the same problem, can anyone help us? Link to comment Share on other sites More sharing options...
fransjaeger Posted November 16, 2014 Share Posted November 16, 2014 Hi I found this which actually works with PS 1.6 url.rewrite-if-not-file = ( "^/api/?(.*)$" => "/webservice/dispatcher.php?url=$1", "^/([a-z0-9]+)\-([a-z0-9]+)(\-[_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)\.jpg$" => "/img/p/$1-$2$3.jpg", "^/([0-9]+)\-([0-9]+)/[_a-zA-Z0-9-]*\.jpg$" => "/img/p/$1-$2.jpg", "^/([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$" => "/img/p/$1/$1$2.jpg", "^/([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$" => "/img/p/$1/$2/$1$2$3.jpg", "^/([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$" => "/img/p/$1/$2/$3/$1$2$3$4.jpg", "^/([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$" => "/img/p/$1/$2/$3/$4/$1$2$3$4$5.jpg", "^/([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$" => "/img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6.jpg", "^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$" => "/img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7.jpg", "^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$" => "/img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8.jpg", "^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$" => "/img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9.jpg", "^/c/([0-9]+)(\-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-]*\.jpg$" => "/img/c/$1$2.jpg", "^/([0-9]+)(\-[_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)\.jpg$" => "/img/c/$1$2.jpg", "^/(.*)$" => "/index.php/$1" ) BUT i still need these lines, in order to make AS4 module work again. RewriteRule ^as4_seositemap.xml$ modules/pm_advancedsearch4/seositemap.xml [L] RewriteCond %{QUERY_STRING} !^controller=products-comparison [NC] RewriteRule ^([a-z]{2})?/?s/([0-9]+)/([a-zA-Z0-9/_-]*) index.php?fc=module&module=pm_advancedsearch4&controller=advancedsearch4&isolang=$1&id_seo=$2&seo_url=$3 [QSA,L] RewriteCond %{QUERY_STRING} ^isolang=([a-z]{2})&id_seo=([0-9]+)&seo_url=([a-zA-Z0-9/_-]*).*p=([0-9]+)$ RewriteRule ^advancedsearch4.php /%1/s/%2/%3?p=%4 [R=301,L] RewriteCond %{QUERY_STRING} ^isolang=([a-z]{2})&id_seo=([0-9]+)&seo_url=([a-zA-Z0-9/_-]*) RewriteRule ^advancedsearch4.php /%1/s/%2/%3? [R=301,L] RewriteCond %{QUERY_STRING} ^id_seo=([0-9]+)&seo_url=([a-zA-Z0-9/_-]*).*p=([0-9]+)$ RewriteRule ^advancedsearch4.php /s/%1/%2?p=%3 [R=301,L] RewriteCond %{QUERY_STRING} ^id_seo=([0-9]+)&seo_url=([a-zA-Z0-9/_-]*) RewriteRule ^advancedsearch4.php /s/%1/%2? [R=301,L] Any help is VERY velcome with my last lines, thanks Link to comment Share on other sites More sharing options...
fransjaeger Posted November 17, 2014 Share Posted November 17, 2014 (edited) I came a step closer, and now more things are working, but still I need help to finish this up url.rewrite-if-not-file = ( #START AS4 RULES #RewriteRule ^as4_seositemap.xml$ modules/pm_advancedsearch4/seositemap.xml [L] "^/as4_seositemap\.xml$" => "/modules/pm_advancedsearch4/seositemap.xml", #RewriteCond %{QUERY_STRING} !^controller=products-comparison [NC] #RewriteRule ^([a-z]{2})?/?s/([0-9]+)/([a-zA-Z0-9/_-]*) index.php?fc=module&module=pm_advancedsearch4&controller=advancedsearch4&isolang=$1&id_seo=$2&seo_url=$3 [QSA,L] "^/([a-z]{2})?/?s/([0-9]+)/([a-zA-Z0-9/_-]*)" => "/index.php?fc=module&module=pm_advancedsearch4&controller=advancedsearch4&isolang=$1&id_seo=$2&seo_url=$3", #RewriteCond %{QUERY_STRING} ^isolang=([a-z]{2})&id_seo=([0-9]+)&seo_url=([a-zA-Z0-9/_-]*).*p=([0-9]+)$ #RewriteRule ^advancedsearch4.php /%1/s/%2/%3?p=%4 [R=301,L] #"^/advancedsearch4.php" => "/%1/s/%2/%3?p=%4", #RewriteCond %{QUERY_STRING} ^isolang=([a-z]{2})&id_seo=([0-9]+)&seo_url=([a-zA-Z0-9/_-]*) #RewriteRule ^advancedsearch4.php /%1/s/%2/%3? [R=301,L] #"^/advancedsearch4.php" => "/%1/s/%2/%3?", #RewriteCond %{QUERY_STRING} ^id_seo=([0-9]+)&seo_url=([a-zA-Z0-9/_-]*).*p=([0-9]+)$ #RewriteRule ^advancedsearch4.php /s/%1/%2?p=%3 [R=301,L] #"^/advancedsearch4.php" => "/s/%1/%2?p=%3", #RewriteCond %{QUERY_STRING} ^id_seo=([0-9]+)&seo_url=([a-zA-Z0-9/_-]*) #RewriteRule ^advancedsearch4.php /s/%1/%2? [R=301,L] #"^/advancedsearch4.php" => "/s/%1/%2?", #END AS4 RULES # AlphaImageLoader for IE and fancybox #RewriteRule ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 [L] "^/images_ie/?([^/]+)\.(jpe?g|png|gif)$" => "/js/jquery/plugins/fancybox/images/$1.$2", "^/api/?(.*)$" => "/webservice/dispatcher.php?url=$1", "^/([a-z0-9]+)\-([a-z0-9]+)(\-[_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)\.jpg$" => "/img/p/$1-$2$3.jpg", "^/([0-9]+)\-([0-9]+)/[_a-zA-Z0-9-]*\.jpg$" => "/img/p/$1-$2.jpg", "^/([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$" => "/img/p/$1/$1$2.jpg", "^/([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$" => "/img/p/$1/$2/$1$2$3.jpg", "^/([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$" => "/img/p/$1/$2/$3/$1$2$3$4.jpg", "^/([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$" => "/img/p/$1/$2/$3/$4/$1$2$3$4$5.jpg", "^/([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$" => "/img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6.jpg", "^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$" => "/img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7.jpg", "^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$" => "/img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8.jpg", "^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$" => "/img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9.jpg", "^/c/([0-9]+)(\-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-]*\.jpg$" => "/img/c/$1$2.jpg", "^/([0-9]+)(\-[_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)\.jpg$" => "/img/c/$1$2.jpg", "^/(.*)$" => "/index.php/$1" ) Edited November 17, 2014 by michaelhjulskov (see edit history) 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