You need to sign in or sign up before continuing.
Newer
Older
Alessandro Cerioni
committed
server_name _;
Alessandro Cerioni
committed
set $matomo_script
"<script type='text/javascript'>
var _paq = _paq || [];
var siteId = <MATOMO_SITE_ID>;
window['siteId'] = siteId;
_paq.push(['enableLinkTracking']);
(function() {
var u='<MATOMO_SERVER_URL>/';
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', siteId]);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
})();
</script>";
FORESTIER Fabien
committed
# rule serving the fr build
Alessandro Cerioni
committed
location / {
FORESTIER Fabien
committed
try_files $uri$args /index.html;
sub_filter '</head>' '$matomo_script</head>';
sub_filter '<html lang="en">' '<html lang="fr">';
Alessandro Cerioni
committed
}
FORESTIER Fabien
committed
# Rule serving the en build
Alessandro Cerioni
committed
location /en {
try_files $uri$args /en/index.html;
Alessandro Cerioni
committed
sub_filter '</head>' '$matomo_script</head>';
FORESTIER Fabien
committed
# redirecting the /fr url to the new location of the fr build
location ~ ^/fr(.*)$ {
return 301 $scheme://$http_host$1$is_args$args;
FORESTIER Fabien
committed
#location /robots.txt {
# rewrite ^ /fr/robots.txt;
Alessandro Cerioni
committed
#}