Forums / Setup & design / Automatic virtual url for users

Automatic virtual url for users

Author Message

Siw Helen Thorslund

Tuesday 30 May 2006 5:07:08 am

We have a customer who want a solution that will give the registered users an automatic virtual url like this:

     http://domain.com/firstname_lastname
 

Today the url is like this:

     http://domain.com/siteaccess/users/user_group/firstname_lastname
 

This is a portal site, so a manual job for doing this is not possible.

Anyone done something like this before?

Thanx in advance for any help...

www.VZT.no ( http://www.VZT.no )
VZT References ( http://http://vzt.no/index.php/vzt_eng/referanser )
VZT Extensions ( http://vzt.no/index.php/vzt_eng/extensions )
www.MediaBase.no ( http://www.MediaBase.no )

Ɓukasz Serwatka

Tuesday 30 May 2006 11:44:08 pm

Hi Siw,

You can write simple workflow event (triggered after publish) then setup new virtual forwarding (look on code in the kernel/content/urltranslator.php). The process will be automaticaly. But when portal will have 20 000 registered users the list can be quite long ;)

mod_rewrite should do the trick. With one additional rule you can redirect users to the user group:

RewriteRule ^(/+[a-z]+\_+[a-z]+)$ /users/administrator_users$1 [R=301,L]

 

http://example.com/administrator_user -> http://example.com/users/administrator_users/administrator_user

This will work but can cause problem when you have e.g folder with the same name pattern (aaa_bbb), so unique pattern for user object name should solve it (and pattern for re_write which match it). Try extend this example.

Good luck!

Cheers,
Lukasz

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog