Forum

Running prestashop rewrite in combination with cache-control?

Alex
29 May 2015, 14:49
Hello, previously, you helped with prestashop rewrites, thanks for that.
I would like to use the cache-control UrlToolkit from Mr. Wadge in combination, but it just doesn't care about the second UrlToolkit.

VHost:
VirtualHost {
Hostname = www.domain.de, domain.de
EnforceFirstHostname = yes
WebsiteRoot = /var/www/domain.de
AccessLogfile = /var/log/hiawatha/domain.de.access.log
ErrorLogfile = /var/log/hiawatha/domain.de.error.log
StartFile = index.php
UseFastCGI = domain.de
TimeForCGI = 3600
SSLcertFile = pem/domain.de/domain.pem
RequireSSL = yes,31536000
RandomHeader = 1000
CustomHeader = Vary: Accept-Encoding
CustomHeader = X-Frame-Options: sameorigin
UseToolkit = prestashop, cache-control
ErrorHandler = 404:/index.php?controller=404
UseGZfile = yes
PreventXSS = yes
PreventSQLi = no
PreventCSRF = yes
}


prestashop toolkit:
UrlToolkit {
ToolkitID = prestashop
Match ^/api/?(.*)$ Rewrite /webservice/dispatcher.php?url=$1
Match ^/([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ Rewrite /img/p/$1/$1$2$3.jpg
Match ^/([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ Rewrite /img/p/$1/$2/$1$2$3$4.jpg
Match ^/([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ Rewrite /img/p/$1/$2/$3/$1$2$3$4$5.jpg
Match ^/([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ Rewrite /img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg
Match ^/([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ Rewrite /img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg
Match ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ Rewrite /img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg
Match ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ Rewrite /img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg
Match ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ Rewrite /img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg
Match ^/c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ Rewrite /img/c/$1$2$3.jpg
Match ^/c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ Rewrite /img/c/$1$2.jpg
Match ^/images_ie/?([^/]+)\.(jpe?g|png|gif)$ Rewrite /js/jquery/plugins/fancybox/images/$1.$2
RequestURI exists Return
Match .*\?(.*) Rewrite /index.php?$1
Match .* Rewrite /index.php
}


cache-control toolkit:
UrlToolkit {
ToolkitID = cache-control
Match ^/.*\.(css|eot|gif|htm|html|ico|jpeg|jpg|js|otf|pdf|png|ps|psd|svg|swf|ttf|txt|woff|woff2)(/|$) Expire 7 days
}


Yes, the rewrite is horrific, and that probably explains the 0,4s response time from Hiawatha.
But still, I'd like to cache a bit on client side, for Google rating purposes aswell.

Hiawatha version: Hiawatha v9.13, cache, IPv6, Monitor, reverse proxy, TLS (1.3.10), Tomahawk, URL toolkit, XSLT
Operating System: Fedora 23
Hugo Leisink
29 May 2015, 14:51
What is you first use the cache-control and then the presta rewrite?
VirtualHost {
...
UseToolkit = cache-control, prestashop
...
}
Alex
29 May 2015, 14:58
That actually fixed it, thanks
This topic has been closed.