Apache .htaccess Rewrite CDN / Parallel Subdomains Drupal CDN
Created:
Last Updated:
First off, I suck at programming... secondly, I suck at apache rewrite rules because it's basically programming. It took me a while to come up with a no-nonsense method to rewrite my parallel / cdn subdomain names, so I wouldn't get hassled by the search engines because it looked like I had all sorts of duplicate content being served from my cdn subdomains.
I say "cdn" subdomains because that's what I searched on forever until I realized I wasn't truly doing content delivery network or content distribution network (CDN), I was simply doing parallel downloads. Yeah, I feel stupid, don't nark on me... :p
The main reason I got so confused is because Drupal has a module called CDN that will do parallel downloads, but it will also do a lot of fun stuff with actual CDN's too.
Moving on, I wanted to share the page that got me started, but also share the RewriteRule I enabled on my site which seems to be working pretty good at this point:
RewriteCond %{HTTP_HOST} ^srv(1|2|3)\.example\.com$ [NC]
RewriteCond %{REQUEST_URI} !\.(css|js|swf|png|gif|jpe?g|pdf|gz|zip)$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R]srv(1|2|3)\.example.com being:
srv1.example.com
srv2.example.com
srv3.example.com
Comments
The Wichita Computer Guy is hosted by one of the best hosting companies on the market: Hostgator.com. Not only do they provide unlimited domain addons, subdomains and parked domains, they also offer unlimited databases, unlimited hosting space and unlimited bandwidth! We have been using Hostgator for several years now and had great customer service support and almost 100% uptime. If you are looking for a website hosting company that provides everything you need for a powerful CMS based website, take a look at Hostgator.com!!

Post Comment