.htaccess duplicate static content loading
I've made a sub-domain for static content (static.site.com) and I have the following .htaccess:
RewriteCond %{HTTP_HOST} www.site.com [NC]
RewriteCond %{REQUEST_FILENAME} \.(jpg|gif|png|css|js|txt|ico|pdf)$ [NC]
RewriteRule ^(.*) http://www.static.site.com/$1 [L,R=301]
Everything is loading fine, but in firebug i have two lines for every file with rewrited path:
http://www.site.com/images/image.png (301 Moved Permanently)
and
http://www.static.site.com/images/image.png (304 Not Modified)
How can I prevent loading my content from main domain开发者_如何学Python. Thanks.
How can I prevent loading my content from main domain. Thanks.
Contents don't load from your main domain. when you request http://www.site.com/images/image.png
server will send you http://www.static.site.com/images/image.png
.
Note: as I understand your files are in subdirectory in main domain. so you can change document root of your subdomain.
精彩评论