[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [cobalt-developers] Replacing /~user with /user



I tried to do a similar thing myself.

However, I believe that for either of the rewrite rules to work, the
server needs to be able to differentiate URLs for user accounts and just
normal folders.

Right now, if you created a folder in your web's root folder called
'~user' and then tried opening it in a web browser, the server would
give you a 404 error.  That's because it assumes that anything with a ~
is a user's home dir.

Likewise, if you tried going to a folder called 'user', it would assume
that you need a folder that is in the /web/ folder.

Therefore you need to give the apache a clear rule when to rewrite the
path to be a user's home directory and when to be a normal folder.  It
won't work to say, "sometimes, show the folder name, other times,
rewrite it to be the user's home directory."

I can't give you the rules to use, but I can give you some ideas.

IDEA 1: use a separate domain for user accounts, but have it served from
the same site. When the server recieves a requst for
users.yourdomain.com/jsmith it will know to rewrite it to the user
"jsmith" home directory.  To make this work, you need to change the
default cobalt rules so that it will not rewrite users.yourdomain.com
into www.yourdomain.com.  Once done, you should find clear instructions
on how to do this on the apache site, under tutorials.  I think it's in
the mod-rewrite faq.

IDEA 2: (aka IDEA 1.5) use a virutal (doesn't exist) folder in place of
the tilde.  www.yourdomain.com/users/jsmith can be acknowledged as if
they had typed www.yourdomain.com/~jsmith.  Just make the apropriate
change to your rewrite rule.

IDEA 3: prefix some character that you like to the user names of your
users that would not normally be in a folder name.  This is good
practice for cobalt stuff in general, due to the problems of having two
users with the same names in different sites.  (jsmith gets all mail
addressed to any jsmith on the cobalt, despite alias settings).  For
example, at one of my sites, www.followers.net, we prefix the letters
'fol' to a user's name.  You could then make a rule (using my example)
that would change www.yourdomain.com/fol* to assume you mean the user's
home dir.  This may be tricky to create a rule for.

IDEA 4: mentioned in a previous email, and the best solution for this
problem in small scale sites, create a symbolic link for your user's
home dir.  I have done this myself, and it works fine.  You would simply
(through telnet or SSH):
cd /home/sites/siteX/web
ln -s ../users/web/username username
You may need to make a change to your httpd configuration files to
support following symlinks.  This would be difficult if you many users,
but you could write a shell script or PHP/Perl function that does it for
you.

Hope this helps,
Matt Nuzum
On Mon, 2002-01-14 at 14:11, Ian McCabe wrote:
    I tried a number of the suggestions, namely:
    
    AliasMatch ^/users/([^/]+)(/(.*))? /home/sites/site17/users/$1/web/$3
    AliasMatch ^/([^/]+)(/(.*))? /home/sites/site17/users/$1/web/$3.
    
    Unfortunately the ^/users rendered the server offline after reboot and
    the second one turned the main site into a free for all listing of its
    content, but no
    proper viewing of any files.
    
    Can I just confirm that I need to place the content of this within the file
    /etc/httpd/conf/httpd.conf
    
    as I could not find any httpd file just within the /etc/httpd folder...
    
    Also, and which may be affecting this: I have a username folder just below
    the main web folder for the site. This appeared straight after trying the
    ln -s command to provided earlier...
    
    Anyone know how using SSH I can safely remove this folder and the folders
    within it that lists a web folder and an identical username folder, which
    again contains a web folder and the username again. This goes on a few
    times...
    
    Thanks
    
    Ian
    
    --> -----Original Message-----
    --> From: cobalt-developers-admin@xxxxxxxxxxxxxxx
    --> [mailto:cobalt-developers-admin@xxxxxxxxxxxxxxx]On Behalf Of CMO -
    --> Thorsten Mitschele
    --> Sent: 14 January 2002 11:25
    --> To: cobalt-developers@xxxxxxxxxxxxxxx
    --> Subject: AW: [cobalt-developers] Replacing /~user with /user
    -->
    -->
    --> you can also add a line to your httpd.conf in
    --> /etc/httpd/httpd.conf for the
    --> virtual-server entry
    -->
    --> search for
    -->
    --> AliasMatch ^/~([^/]+)(/(.*))? /home/sites/site17/users/$1/web/$3
    -->
    --> and add the line
    -->
    --> AliasMatch ^/users/([^/]+)(/(.*))? /home/sites/site17/users/$1/web/$3
    -->
    --> so you can access your users-dirs by using
    --> www.domain.com/users/username
    --> or
    --> www.domain.com/~username
    -->
    -->
    --> If you want to have this feature with every new installed server you can
    --> also add this to your Vsite.pm in
    -->
    --> /usr/lib/perl5/site_perl/5.005/Cobalt/Vsite.pm
    -->
    --> Search for:
    -->
    --> <VirtualHost $addr>
    --> ServerName $name
    --> ServerAdmin $serveradmin
    --> DocumentRoot $Htgroup_dir/$group/$Webdir
    --> RewriteEngine on
    --> RewriteCond %{HTTP_HOST}                !^$addr(:80)?$my
    --> RewriteCond %{HTTP_HOST}                !^$name(:80)?$my
    --> RewriteRule ^/(.*)                      http://$name/\$1 [L,R]
    --> RewriteOptions inherit
    --> AliasMatch ^/~([^/]+)(/(.*))? $Htgroup_dir/$group/users/\$1/web/\$3
    --> </VirtualHost>
    --> EOF
    -->
    --> and add
    -->
    --> AliasMatch ^/users/([^/]+)(/(.*))? $Htgroup_dir/$group/users/\$1/web/\$3
    -->
    --> after the Line: AliasMatch ^/~([^/]+)(/(.*))?
    --> $Htgroup_dir/$group/users/\$1/web/\$3
    -->
    -->
    -->
    -->
    -->
    -->
    --> Mit freundlichen Grüßen,
    -->
    --> Thorsten Norman Mitschele
    --> Geschäftsführer
    -->
    --> ----------------------------------------------
    --> CMO Internet Dienstleistungen GmbH
    --> Postfach 13 35          72577 Dettingen / Erms
    --> Tel: 07123 / 72 67-0    Fax: 07123 / 72 67-150
    --> e-Mail: info@xxxxxx     Web: http://www.cmo.de
    -->
    -->
    --> > -----Ursprüngliche Nachricht-----
    --> > Von: cobalt-developers-admin@xxxxxxxxxxxxxxx
    --> > [mailto:cobalt-developers-admin@xxxxxxxxxxxxxxx]Im Auftrag von Ryan
    --> > Verner
    --> > Gesendet: Montag, 14. Januar 2002 11:06
    --> > An: cobalt-developers@xxxxxxxxxxxxxxx
    --> > Betreff: Re: [cobalt-developers] Replacing /~user with /user
    --> >
    --> >
    --> > Try doing this from the actual website http folder, not the users.
    --> >
    --> > You're trying to make a link from inside the website, not
    --> inside the users
    --> > folder.
    --> >
    --> > - Ryan
    --> >
    --> > --=--
    --> >
    --> > :: Ryan Verner :: xfesty/irc.whackpack.com ::
    --> > :: ICQ :: 76626240 ::
    --> > :: <festy@xxxxxxxxxxxxx> ::
    --> > :: <xfesty@xxxxxxxxx> ::
    --> >
    --> > ----- Original Message -----
    --> > From: "Ian McCabe" <idmccabe@xxxxxxxxxxxxxxxx>
    --> > To: <cobalt-developers@xxxxxxxxxxxxxxx>
    --> > Sent: Monday, January 14, 2002 7:25 AM
    --> > Subject: RE: [cobalt-developers] Replacing /~user with /user
    --> >
    --> >
    --> > | Tried what you suggested, but I think I may have gone wrong
    --> somewhere.
    --> > |
    --> > | I went into the users folder and typed the -ln -s ~username username
    --> > |
    --> > | I think that is where I went wrong. Should I have done it
    --> in that users
    --> > | folder, just beneath that users folder in the main users
    --> folder listing
    --> > all
    --> > | of them, or further below that.
    --> > |
    --> > | I know have a structure as such: /users/username/ with another
    --> > two folders
    --> > | of username and web, but inside this username I have
    --> another folder with
    --> > | username and web folders, and within that username I have
    --> > another username
    --> > | and web folder.
    --> > |
    --> > | Oooooooooops
    --> > |
    --> > | With this though, I still can not get to access
    --> domain.com/username as
    --> > | opposed to domain.com /~username
    --> > |
    --> > | Do I need to reboot for it to work or have I totally mucked
    --> this up and
    --> > any
    --> > | ideas on how I safely remove these additional folders of
    --> > username and web
    --> > | inside the username and web sub-folders....
    --> > |
    --> > | Thanks Ian
    --> > |
    --> > | --> -----Original Message-----
    --> > | --> From: cobalt-developers-admin@xxxxxxxxxxxxxxx
    --> > | --> [mailto:cobalt-developers-admin@xxxxxxxxxxxxxxx]On
    --> Behalf Of Ryan
    --> > Verner
    --> > | --> Sent: 13 January 2002 17:43
    --> > | --> To: cobalt-developers@xxxxxxxxxxxxxxx
    --> > | --> Subject: Re: [cobalt-developers] Replacing /~user with /user
    --> > | -->
    --> > | -->
    --> > | --> Sure...
    --> > | -->
    --> > | --> telnet/ssh into your cobalt, cd to the correct http serving
    --> > | --> folder of the
    --> > | --> site you're interested in, and do this:
    --> > | -->
    --> > | --> ln -s ~user user
    --> > | -->
    --> > | --> Replacing user with the username, of course.
    --> > | -->
    --> > | --> This of course requires that your site DOES follow
    --> SymLinks (Options
    --> > | --> SymLinks in your apache config), which I'm not sure on your
    --> > particular
    --> > | --> Cobalt is enabled or not.  Give it a try, in any case.
    --> > | -->
    --> > | --> - Ryan
    --> > | -->
    --> > | --> --=--
    --> > | -->
    --> > | --> :: Ryan Verner :: xfesty/irc.whackpack.com ::
    --> > | --> :: ICQ :: 76626240 ::
    --> > | --> :: <festy@xxxxxxxxxxxxx> ::
    --> > | --> :: <xfesty@xxxxxxxxx> ::
    --> > | -->
    --> > | --> ----- Original Message -----
    --> > | --> From: "Ian McCabe" <idmccabe@xxxxxxxxxxxxxxxx>
    --> > | --> To: <cobalt-developers@xxxxxxxxxxxxxxx>
    --> > | --> Sent: Monday, January 14, 2002 1:52 AM
    --> > | --> Subject: [cobalt-developers] Replacing /~user with /user
    --> > | -->
    --> > | -->
    --> > | --> | Hi all,
    --> > | --> |
    --> > | --> | Does anyone know how or what config file(s) need changing to
    --> > | --> get rid of
    --> > | --> the
    --> > | --> | ~ that apears infront of the users login name when
    --> used for a user
    --> > web
    --> > | --> area?
    --> > | --> |
    --> > | --> | i.e. by default the RaQ system has say:
    --> > | --> |
    --> > | --> | www.mydomain.com/~userloginname1
    --> > | --> | www.mydomain.com/~userloginname2 by default.
    --> > | --> |
    --> > | --> | I would like if possible to change this to:
    --> > | --> |
    --> > | --> | www.mydomain.com/userloginname1
    --> > | --> | www.mydomain.com/userloginname2
    --> > | --> |
    --> > | --> | Any ideas, suggestions or possible solutions would be
    --> very much
    --> > | --> | appreciated.....
    --> > | --> |
    --> > | --> | Ian
    --> > | --> |
    --> > | --> |
    --> > | --> | _______________________________________________
    --> > | --> | cobalt-developers mailing list
    --> > | --> | cobalt-developers@xxxxxxxxxxxxxxx
    --> > | --> | http://list.cobalt.com/mailman/listinfo/cobalt-developers
    --> > | --> |
    --> > | -->
    --> > | --> _______________________________________________
    --> > | --> cobalt-developers mailing list
    --> > | --> cobalt-developers@xxxxxxxxxxxxxxx
    --> > | --> http://list.cobalt.com/mailman/listinfo/cobalt-developers
    --> > |
    --> > |
    --> > | _______________________________________________
    --> > | cobalt-developers mailing list
    --> > | cobalt-developers@xxxxxxxxxxxxxxx
    --> > | http://list.cobalt.com/mailman/listinfo/cobalt-developers
    --> > |
    --> >
    --> > _______________________________________________
    --> > cobalt-developers mailing list
    --> > cobalt-developers@xxxxxxxxxxxxxxx
    --> > http://list.cobalt.com/mailman/listinfo/cobalt-developers
    --> >
    --> >
    -->
    --> _______________________________________________
    --> cobalt-developers mailing list
    --> cobalt-developers@xxxxxxxxxxxxxxx
    --> http://list.cobalt.com/mailman/listinfo/cobalt-developers
    -->
    
    
    _______________________________________________
    cobalt-developers mailing list
    cobalt-developers@xxxxxxxxxxxxxxx
http://list.cobalt.com/mailman/listinfo/cobalt-developers