Subdomain Images Not Loading properly

Posted on 2012-09-17
Last Modified: 2012-09-19
I created a subdomain for a website:
I am using an htaccess file to detect if a visitor is mobile, if yes they are redirected to if not they go to

I didn't want to have to upload images to the mobile subdomain, I wanted to call them directly from the main site (www.) using

The problem is that the images are loading on my desktop computer  (the links are correct/no broken links), but on my cellphone (and anyone else that has tested it) the images are not loading unless they are either: in the subdomain (without the http request) or called from a different domain altogether. Images called from will not load on the cellphone.

I called tech support and while they were not able to directly help me, they felt it might be the .htaccess file. They found the same thing. Images loaded on desktops but not on cellphones.

I have very little understanding of this, but is there anything in the following that could be causing the problems?

RewriteEngine on
rewritecond %{http_host} ^ [nc]
rewriterule ^(.*)$$1 [R=301,L]

AddType text/html .shtml .html .htm
AddHandler server-parsed .shtml .html .htm

# Check if this is the noredirect query string
RewriteCond %{QUERY_STRING} (^|&)noredirect=true(&|$)
# Set a cookie, and skip the next rule
RewriteRule ^ - [CO=mredir:0:%{HTTP_HOST},S]

# Check if this looks like a mobile device
# (You could add another [OR] to the second one and add in what you
#  had to check, but I believe most mobile devices should send at
#  least one of these headers)
RewriteCond %{HTTP:x-wap-profile} !^$ [OR]
RewriteCond %{HTTP:Profile}       !^$ [OR]
RewriteCond %{HTTP_USER_AGENT} "iPhone|iPad|iPod" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} BlackBerry [NC,OR]
RewriteCond %{HTTP_USER_AGENT} Android [NC,OR]
RewriteCond %{HTTP_USER_AGENT} googlebot-mobile [NC]
# Check if we're not already on the mobile site
RewriteCond %{HTTP_HOST}          !^m\.
# Check to make sure we haven't set the cookie before
RewriteCond %{HTTP:Cookie}        !\smredir=0(;|$)
# Now redirect to the mobile site
RewriteRule ^{REQUEST_URI} [R,L]

ErrorDocument 404 /notfound.html

Any help would be greatly appreciated.
Question by:dresdena1

    Author Comment

    As a follow up comment to this question. When I remove the redirect section of the htaccess file the images load on the mobile browser just fine.

    LVL 51

    Accepted Solution

    >  RewriteRule ^{REQUEST_URI} [R,L]

    look strange, can you replace it by

       RewriteRule .*{REQUEST_URI} [R,L]

    also, can you please post the IMG tage which is not loaded (please only that IMG tag and *not* the complete source)

    Author Closing Comment

    Thank you for the response.
    While I was waiting, I found and downloaded the Apache file and it is working correctly.
    Thank you again.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
    The case of the missing phone talks about the way a small electronic gadget (the mobile phone) has penetrated into our lives and has made us addicted to it.
    This Micro Tutorial will demonstrate how to add subdomains to your content reports. This can be very importing in having a site with multiple subdomains.
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now