Rewrite and subdomains

Topics: Developer Forum, User Forum
Nov 5, 2012 at 9:19 PM

Hi Guys! for SEO purposes I want to eliminate the subdomain blog. I cannot do it from the site, so I'm giving a try with IIRF. My idea es to have domian.net/blog to show blog.domain.net (not redirect).

I also want a redirect from blog.domain.net to domain.net/blog

If the URI is blog.domain.net/intranet then do nothing. I think I got that running.

Now, if the URI is blog.domain.net/blog/june2012 (or any other page) I'm getting /blog/blog in the rewrite and getting an error. What I dont know  how to do is to do rewrite to /blog if the orginal is blog.domain.net (no trailing path) and if the URI has a path, to reserve it.

I'de appreciate any suggestions


here is my iirf.ini:

RewriteCond %{HTTP_HOST} blog.domain.net [NC]

RewriteCond %{HTTP_VIA} ^$  [NC] [OR]

RewriteCond %{HTTP_URL} !/intranet/[OR]

RewriteCond %{HTTP_URL} !/blog/

RedirectRule ^(.*)$ http://domain.net/blog$1  [R=301]

RewriteCond %{HTTP_HOST}   ^domain\.net$  [I]

RewriteCond %{HTTP_URL} /blog

ProxyPass ^(.*)$ http://blog.domain.net$1 [U,I]