开发者

.htaccess duplicate static content loading

开发者 https://www.devze.com 2023-04-08 09:40 出处:网络
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]

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号