Ad

Multisite Solution Favicon.ico Problem In Nginx

- 1 answer

if ($host ~* "^([^.]+(\.[^.]+)*)\.([a-zA-Z1-9-_]+).([a-zA-Z]+)\/favicon.ico(/?)+$"){
set $domainp1 $2;
set $domainp2 $3;
rewrite ^/favicon.ico(/?)+$ /uploads/$domainp1.$domainp2/favicon.ico last;
break;
}

Hello Developers.

I need to configure my favicon.ico for multiple sites. The above code has some problems and does not work. What should be done to achieve my needs?

Thanks

Ad

Answer

if ($host ~* "^([a-zA-Z1-9\-_]+\.|)([a-zA-Z1-9\-_]+).([a-zA-Z]+)$"){

set $domainp1 $2;
set $domainp2 $3;
rewrite ^/favicon.ico(/?)+$ /uploads/$domainp1.$domainp2/favicon.ico last;
}

this code works now. is there any other solution?

Ad
source: stackoverflow.com
Ad