I will tell you right off the bat that I don’t “get” regular expressions, and I don’t get .htacess rewrite rules. I wish I understood them better, but there’s some part of my brain that just fights me every time I try to get a better all-around understanding. Still, I have to (and want to) do stuff with htaccess, so I end up digging for code online, and trying stuff until something works. I wish I knew more about WHY it worked, but I’m just happy that it works at all. Image may be NSFW.
Clik here to view.
Now that I’m done with my disclaimer, on to the point of this post. I had to use a htaccess file to redirect a subdomain to a directory in the main domain. For example: http://blog.mysite.com needed to point to http://www.mysite.com/blog/
After much digging and trial and error, this seems to work:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^blog\.mysite\.com
RewriteRule ^(.*)$ /blog/$1 [L]
Posted by: MiracleStudios.us
Image may be NSFW.
Clik here to view.

Clik here to view.
