Welcome! Log In Create A New Profile

Advanced

Assets

Posted by hussan 
Assets
October 25, 2011 07:51AM
Hi,

How i can create this rules in nginx ?

When i have :

www.site.com/css/css.css ---> www.site.com/template/webroot/css/css.css
www.site.com/img/img.jpg ---> www.site.com/template/webroot/img/img.jpg

and when:

www.site.com/css/admin/css.css ---> www.site.com/admin/webroot/css/admin/css.css
www.site.com/img/admin/img.jpg ---> www.site.com/admin/webroot/img/admin/img.jpg


Thanks
Re: Assets
October 29, 2011 10:56PM
Hi,
You can rewrite those urls as such like so:

rewrite ^/css/css.css$ /template/webroot/css/css.css last;
rewrite ^/img/img.jpg$ /template/webroot/img/img.jpg last;

rewrite ^/css/admin/css.css$ /admin/webroot/css/admin/css.csslast;
rewrite ^/img/admin/img.jpg$ /admin/webroot/img/admin/img.jpg last;

You should also take a look at:
http://wiki.nginx.org/HttpRewriteModule
http://nginx.org/en/docs/http/converting_rewrite_rules.html

For more info ;)
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 85
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready