Cotonti / Open Source PHP Content Management FrameworkContent Management Framework

Форуми / Cotonti / General / User Names as Subdomains

Eugene
#1 17.01.2013 09:08

Please, advice how to implement rewrite of user names as sub-domains of web-site?

I hope it is possible to tweak it without editing .htaccess.

So, I try this in urltrans.dat:

users	m=details&u=*			{cot_url_username()}.{$_host}

and this

users	m=details&u=*			http://{cot_url_username()}.{$_host}

in first case link is relative to domain. In second case, it didn't work.

Please, help with this!

Macik
#2 20.01.2013 21:34

What version do you use (Genoa/Siena)?
What aim you want to achieve? 

To be cleared… You can not «drive» this system for full without modifying «.htaccess». It's a two-ends system - one part is defined with «urltrans.dat» that force CMS to automatic (with cot_url function) translate URL to «magic» format you need. Second part is .htaccess that takes site user coming with «magic» URL to a CMS real address.

So, if you need user get profile details by accessing URL like http://username.yousite.com/  you must check this steps (actual for Siena version):

1. install «URL Editor» plugin
2. select «Custon urltrans.dat» in settings of «URL Editor»
3. Make rule in Admin page of «URL Editor», like this:
     users         m=details&u=*     http://{$u}.{$_rhost}{$_path}index.php

Now you will get URL like:  http://admin.site.com/index.php?m=details    with executing cot_url('users','m=details&u=admin') some where on site.

4. Make changes in .htaccess to propper «translate» http://admin.site.com/index.php?m=details in normal  http://site.com/users.php?&m=details&u=admin

 

https://github.com/macik
правильный хостинг — https://goo.gl/fjCa1F
Eugene
#3 22.01.2013 11:17

I'm always using last version of Siena.

I need to develop a website - where users would have their page of details (users?m=details...) as subdomain of main domain. So, it will look like a small website.

thank you for details ))) it is interesting, that in #3 you're placing index.php in the end. I wasn't thinking about this.

I understand that urltrans is not enough, but I do not neet to rewrite SPECIFIC user - I need a mask for all users, but don't know how to setup VirtualHost and .htaccess to work with this urltrans we created...

Would you give more advice?

Kilandor
#4 23.01.2013 15:05

It typically requires a Wildcard on your DNS for your domain. Some hosts will not do this for you.

I honestly just recommend using example.com/username or example.com/users/name