Situation: main site is http://www.example.com. Just moved our blog from a 3rd party blog provider, where it was located at blog.example.com, to our main site -- currently http://www.example.com/blog. Would really like to keep blog.example.com (or even blog.example.com/blog if necessary, as I suspect it might be) for branding reasons.
Currently all subdomains point to the main site. I use mod_rewrite to point the blog subdomain to http://www.example.com/blog, and 301 redirects to point the individual article pages to their new URLs (only about 50 or so articles). Code for that first part (super basic):
Code: Select all
RewriteCond %{HTTP_HOST} ^blog.example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/blog/$1 [L]
Code: Select all
RewriteCond %{HTTP_HOST} ^blog\.example\.com [NC]
RewriteCond %{REQUEST_URI} !^/index\.php [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php?Itemid=27 [NC,L]
Code: Select all
#RewriteCond %{HTTP_HOST} !^blog\.example\.com [NC]
#RewriteCond %{REQUEST_URI} ^/(blog|keyword|component\/blog_calendar) [NC]
#RewriteRule ^(.*)$ http://blog.example.com/$1 [NC,L]
Code: Select all
RewriteCond %{HTTP_HOST} !^blog\.example\.com [NC]
RewriteCond %{REQUEST_URI} ^/(blog|keyword|component\/blog_calendar) [NC]
RewriteRule ^(.*)$ http://blog.example.com/$1 [NC,L]
RewriteCond %{HTTP_HOST} ^blog\.example\.com [NC]
RewriteCond %{REQUEST_URI} !/(blog|keyword|component\/blog_calendar) [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [NC,L]
I tried this, since sometimes the request URI is in Joomla query string format (for reasons I can't figure out):
Code: Select all
RewriteCond %{HTTP_HOST} ^blog\.example\.com [NC]
RewriteCond %{REQUEST_URI} !Itemid=(27|158|159|179|184) [NC]
RewriteCond %{REQUEST_URI} !option=(com_blog_calendar|com_sectionex|com_tag) [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [NC,L]
Any ideas as to what I'm doing wrong? I'm also open to completely other suggestions. Mod_rewrite is just how I'm accustomed to doing these sorts of things.
Thanks a bunch for reading, and for any help in advance.