apache - How to rewrite paths for certain file types with .htaccess? -
i move static files cdn. there images, fonts, js, css, , of them include paths other files. e.g. file site.com/fonts/fontname.css
@ static.othersite.com/folder/fonts/fontname.css
, , contain path src:url(fontname.eot)
. how rewrite paths .htaccess?
the following code should work:
rewriteengine on rewritecond %{http_host} ^site\.com$ [nc] rewritecond %{request_uri} \.(jpe?g|png|svg|css|js|eot|ttf|woff2?)$ [nc] rewriterule ^ http://static.othersite.com/folder%{request_uri} [r=301,l]
keep adding other file extensions 2nd rewritecond
directive above.
Comments
Post a Comment