Forum Moderators: phranque

Message Too Old, No Replies

Subdomain and rewriting

how to transform user.blob.domain.com -> user.blog.domain.com/blogs/

         

EasyExpat

10:58 am on Jun 14, 2005 (gmt 0)

10+ Year Member


Hi,

I have been trying for hours to get this right and unfortunatly, event after reading all the RewriteCond and RewriteRule I cannot make it :-(

I put a blog into /home/mydomain/blogs

My server works with subdomains as I can ping this.host.does.not.exist.mydomain.com.

Lets take an example with user tweetee.
I would like to have his blog under: -http://tweetee.blob.mydomain.com

Unfortunatly it doesn't work as it cannot find where is the blog directory.
I can only access if I put: -http://tweetee.blob.mydomain.com/blogs/

I tried to change my htaccess at the root of the site to:
RewriteRule http://(.*\.blog\.mydomain\.com/) http://$1/blogs/ [QSA,L,R=301]

but it doesn't work.

Could anybody help on that issue please?

EasyExpat

11:51 am on Jun 14, 2005 (gmt 0)

10+ Year Member


I think I found it:

#-- Blog
RewriteCond %{HTTP_HOST} ^([^\.]+)\.blog\.mydomain\.com
RewriteRule (.*) /blogs/%2 [QSA,L]