Using subdomain’s folder using htaccess

I was using http://www.idealwebtools.com/blog/ as my blog url for various reasons. Yesterday I added a subdomain blog.aimk.org (aimk.org is added as an addon domain with dns hosted with idealwebtools.com but the site hosted with a different hosting company. I have done it to host inferno.aimk.org with idealwebtools.com), which takes the same folder public_html/blog/.

http://blog.aimk.org was just a redirect to aimk.blogspot.com so I could tweak the .htaccess a bit and make it work. (I could have also done this by troubling by hosting company to add few lines to the http.conf, which I avoided as I could handle it).

What is done?

RewriteEngine On
RewriteCond % ^blog.aimk.org$ [OR]
RewriteCond % ^www.blog.aimk.org$
RewriteRule ^(.*)$ http://www.aimk.blogspot.com [R=301,L]
(rest of the wordpress htaccess for cleaner url)

Some Tweaking for inferno.aimk.org
http://www.inferno.aimk.org and http://inferno.aimk.org (without www) both exists, now we will do few htaccess tricks to redirect www to non www subdomain.
RewriteCond % ^www.inferno.aimk.org
RewriteRule ^(.*) http://inferno.aimk.org/$1 [R=301,L]

It is simple for one who knows and difficult for others :). Enjoy

Leave a Reply

Your email address will not be published. Required fields are marked *