It took 12 hours and dozen of posts on stackoverflow turned purple but still don’t know what did I do wrong
I’m tried to setup cookie-free domain using mod_rewrite on .htaccess rewriting subdomain (a1,a2,a3,a4,a5) to root.
here is what I got so far..
RewriteCond %{HTTP_HOST} ^a1.my-domain.com [NC]
RewriteRule ^(.*)$ http://www.my-domain.com/$1 [R=301,NC]
then, I uploaded to the root directory and opened a php file from the browser with this code
<img src="http://a1.my-domain.com/images/imgname.jpg">
also tried go directly to the URL
http://a1.my-domain.com/images/imgname.jpg
http://a1.my-domain.com/
but both are not working, the image didn’t show up, while other codes in .htaccess works just fine. Could you please suggest a solution on this?
////////////// EDIT MORE INFO //////////////
According to – http://www.stoimen.com/blog/2010/03/12/use-cookie-free-domain-and-cdn-for-static-content/ – I want to setup a Cookie Free Domain without moving resources to the subdomain and to create a pararel load which, from what I understand, increase connection when the website load and in the same time make it cookie free.
I want to load the html below
<img src="http://www.my-domain.com/images/imageA.jpg">
<img src="http://www.my-domain.com/images/imageB.jpg">
<img src="http://www.my-domain.com/images/imageC.jpg">
using these below (pointing ‘a*.my-domain.com’ to ‘www.my-domain.com’)
<img src="http://a1.my-domain.com/images/imageA.jpg">
<img src="http://a2.my-domain.com/images/imageB.jpg">
<img src="http://a3.my-domain.com/images/imageC.jpg">
By reading about Cookie-Free, I just need to create a subdomain and point it to the root www but, as my host provides DirectAdmin control panel, I can’t point subdomain anywhere but the subfolder with its name and I don’t have access to Apache for modifying a Virtual Host configuration. So, I tried to use .htaccess to do it. Can you suggest how to do it? and I’m quite new to this so, please correct me if I misunderstood. Thank you 🙂
Going off what you’ve been saying in the comments, it sounds like you are trying to increase load times by spreading content across multiple hostnames, so more stuff is loaded in parallel.
An A record is a host – you would use this if you wanted a physical sub directory directory.
A CNAME is an alias, and points to another address. It’s simply a ‘pretty URL’ masking something else, if you will.
Sounds like you need a CNAME, not an A record.
Unlike my comment earlier, as far as I am aware, you need to specify all your CNAMEs. Each CNAME
a1a2etc would point to your root domain.You then need to add
a1.domain.comas aliases to your domain in your web control panel.Specify each hostname and redirect it with .htaccess file.
I’m not sure, but propagation might be an issue here, I forget if CNAMES are instantly accessible or not…