Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Subdomain for each user

Started by pbrown223, October 19, 2010, 02:45:20 PM

Previous topic - Next topic


Hi.  I searched, but wasn't able to find anything on this.

I'm using SMF 2.0RC3.
I'm creating an art forum and I'd like to have a subdomain ( for each user that redirects to their profile.  I can create and redirect subdomains manually through CPanel, but is there a way to have a subdomain automatically created when the user registers?

Also, when I type the subdomain for a user it redirects to the profile, but the subdomain doesn't stay in the address bar, it reverts to  Is there a way to make the subdomain stay in the address bar?

Any and all help is greatly appreciated!  :D

Oh, I have these mods installed also:

- Reason for editing mod
- Pretty URLs
- nCode Image Resizer
- Order Custom Profile Fields
- ENotify
- Member Awards
- Bookmarks
- Simpleportal
- Thumbnail Topic Mod
- Custom Top Menu
- Hide Edited Line
- PM Auto Responder
- Aeva Media
- Menu Order
- Current Signature Mod

- Default and Banned User Avatars
- BBC in Custom Title
- VB Style Board Index
- AddThis
- Advanced Reputation System
- PagesToGo
- Ultimate Profile
- Separate Replies and Views Column
- Favicon
- Moderator and Administrator Comment Tags
- Dyanmic Memberlist
- Online status on login
- Member Color Link
- AJAX Instant Quick Reply


i dont think you can easily get smf to communicate with cpanel to be able to set up subdomains

Hj Ahmad Rasyid Hj Ismail

I think it may be possible with the use or manipulation of .htaccess / apache. It will not be easy though. One of the difficulty that you may faced will be the Pretty URLs. It will be better if Pretty URLs mod can do this via its settings. You may want to request to its author or pay him or hire someone to do this for you.

Hj Ahmad Rasyid Hj Ismail

I'll like playing with .htaccess sometimes and I've done some reading. Try have a look into this code and play a bit with it in a test forum with Pretty Urls mod installed and see how it goes. The first two lines, I believe, is a protection, which you need to create for all existing subdomain and subfolder. The balance can be set for your profile subdomain and redirect it to the respective profile subfolder. I am not sure how but I know there must be a way a round if you search and ask around hard enough.

# if requested subdomain is not "www"
RewriteCond %{HTTP_HOST} !^(www\.)?example\.com [NC]
# and we have not already rewritten this request to the subdomain's subfolder
RewriteCond %{THE_REQUEST} !/folder/.
# extract requested subdomain to %2
RewriteCond %{HTTP_HOST} ^(www\.)?([^.]+)\.example\.com
# rewrite the request to the subdomain's subfolder
RewriteRule (.*) /folder/%2/$1 [L]


Thanks for the responses Oya and ahrasis.

ahrasis, I'll definitely give that code a try in my test forum and do some research on it.  Thanks again!  :)

 Hello !
i'm interresting by this, it's a very good idea.
Tell me if you are found a solution !