Redirect all media requests (css, js and images) with htaccess

3

I am building an MVC application and I was having some problems with the path of the css, js and images files in the html ... I was given a solution to use the <base> tag to set the path that all html files would follow, ex: <base href="#">#

asked by anonymous 25.12.2015 / 04:22

1 answer

2

Did you try something like this? I think it solves your problem.

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{DOCUMENT_ROOT}/public/$0 -f
    RewriteRule ^.+\.(jpg|jpeg|gif|png|ico|css|js|swf)$ /public/$0 [L]
    
25.12.2015 / 23:52