CodeIgniter Forums
Creating a blogservice - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: Creating a blogservice (/thread-21640.html)

Creating a blogservice - El Forum - 08-16-2009

[eluser]R. Oerlemans[/eluser]
Hello There,

My next project will be a blogservice, writed in CI. But i have a question where you hopefully have the answer on.

For example my siteadress is Whene a user register with the username hellothisismyusername his/her adress is:

When a visitor come to the url with a username before the . (dot) I want codeigniter select the controlers out of the folder:

/ controllers / blogs

Is there a possibility to easy fix this? In the query's after that is want to use:
->where('b_id' = $_bloginfo['blogid']);

$_bloginfo contains all the info (username, blogname, blogid) from that blog.

Is there an easy way to fix things like this?

Thank you very much.

Kind Regards,
R. Oerlemans

Creating a blogservice - El Forum - 08-16-2009

I always wondered how to do this Wink.

As far as I know, first the DNS setup must let pass all incoming sub domain requests. This I don't know how to do.

Once inside :

1. it should be possible using rewrite rules in .htaccess, see Rewrite Guide (2.0), Virtual User Hosts :
Assume that you want to provide for the homepage of username via just DNS A records to the same machine and without any virtualhosts on this machine.

For HTTP/1.0 requests there is no solution, but for HTTP/1.1 requests which contain a Host: HTTP header we can use the following ruleset to rewrite internally to /home/username/anypath:

RewriteEngine on
RewriteCond   %{HTTP_HOST}                 ^www\.[^.]+\.host\.com$
RewriteRule   ^(.+)                        %{HTTP_HOST}$1          [C]
RewriteRule   ^www\.([^.]+)\.host\.com(.*) /home/$1$2

2. I also found this page on, Dynamically Configured Mass Virtual Hosting, which probably contains better solutions

Creating a blogservice - El Forum - 08-17-2009

[eluser]R. Oerlemans[/eluser]
I was thinking of to set a subdomain wildcard in DirectAdmin, but don't know how to go furthur then.