Hi,
I was wondering if it is possible to let new users automatically have a blog on their own subdomain, ie johnsmith.mydrupalsite.com
I searched for this but wasn't quite able to figure out the answer.

Dave

Comments

kajamohideen’s picture

- Add A Record for *.yourdomain.com pointing to your Web - Host (No need, if you use your web-host's nameservers)
- Enable Wildcard Subdomain Alias for your domain in your web-hosting account (You may require assistance from your web-host)

Configure Apache Wildcard support
Assuming your Apache config uses vHosts, your new configuration would look like this:

<virtualhost>
ServerName domain.com:80
ServerAlias *.domain.com
...
..
</virtualhost>

The ServerAlias statement enables Wildcard support for your domain. From now on, your Apache vHost will react on non-existent subdomains.

- Add the following lines to your .htaccess

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} !^(www\.)?yourdomain\.com$ [NC]
RewriteCond %{HTTP_HOST} ^(www\.)?([^\.]+)\.yourdomain\.com$ [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/blogs/%2/$1 [R=301,L]

- You have to use pathauto to make http://www.yourdomain.com/blogs/username point to your users' blog.

Hope, this will help you. Post your comments.

R. Kaja Mohideen
MyiStop.com | Your Web Zone

deighve’s picture

Thanks! This is great.

911’s picture

Hi, I searched for a solution tonuse Drupal as a bloghosting site with subdomains like blogger.com and found this post. Sounds like this is how u can do it with Drupal.

But is the Userblog Native running with the subdomain.domain.com URL? And all the links are written native for the subdomain.domain.com? or is the blog just available under the subdomain.domain.com and redirects to domain.com/blogs/username? If I tiype in the domain I finally get redirected to the domains subfolder?

Best Regards

brandontrew’s picture

Hello

I now have subdomain module running properly, however I can't figure out how to use pathauto to do this.
The subdomain module says I need to type [subdomain] into the"beginning" of the node path??

Please help!

daphisto’s picture

subscribe

comicdom’s picture

This is fantastic!

Thanks so much for the info. =]

Kevin Bush
www.COMICDOM.net
Drupal v6.3

joeyjoey’s picture

Brilliant brilliant info,

One question, how can I make the subdomain in the url stick and still resolve to the correct address,

I have changed
RewriteRule ^(.*)$ http://www.domain.com/blog/%2/$1 [R=301,L]

to

RewriteRule ^(.*)$ http://www.domain.com/blog/%2/$1 [L]

It leaves the URL in the address bar but seems to mess up drupals URL rewriting, is there a solution, have beenr acking my brains and searching hard!

Flying Drupalist’s picture

There's a subdomain module that you can use in conjunction with pathauto.

joeyjoey’s picture

That is so perfect, I cant believe I missed it. Sometimes I forget how amazing the world of drupal is.

drale01’s picture

All of this makes good redirect.
But I want my url stays on:

www.user.domain.com

instead

www.domain.com/blogs/user

Is this possible?