Per-user web directories
On systems with multiple users, each user can be permitted to have a web site in their home directory using the
directive. Visitors to a URL UserDirhttp://example.com/~username/
Note that, by default, access to these directories is not enabled. You can enable access when using
by uncommenting the lineUserDir
#Include conf/extra/httpd-userdir.conf
in the default config file, and adapting the httpd-userdir.conf
file as necessary, or by including the appropriate directives in a Directory
block within the main config file.
If a path is given which does not start with a leading slash, it is assumed to be a directory path relative to the home directory of the specified user. Given this configuration:
will be translated to the file path /home/rbowen/public_html/file.html
If a path is given starting with a slash, a directory path will be constructed using that path, plus the username specified. Given this configuration:
If a path is provided which contains an asterisk (*), a path is used in which the asterisk is replaced with the username. Given this configuration:
UserDir /var/www/*/docs
. If it isn't found, Apache will search for rbowen
The above example will redirect a request for http://example.com/~bob/abc.html
UserDir disabled root jro fish
The configuration above will enable the feature for all users except for those listed in the disabled
statement. You can, likewise, disable the feature for all but a few users by using a configuration like the following:
documentation for additional examples.UserDir
Then, presuming that UserDir
to a value sufficient for the directives that you want to permit the users to modify. See the AllowOverride.htaccess tutorial for additional details on how this works.
Modules | Directives | FAQ | Glossary | Sitemap
Apache HTTP Server Version 2.4
Per-user web directories
Available Languages: en | fr | ja | ko | tr
Per-user web directories
Setting the file path with UserDir
The UserDir directive specifies a directory out of which per-user content is loaded. This directive may take several different forms.
Redirecting to external URLs
The UserDir directive can be used to redirect user directory requests to external URLs.
Restricting what users are permitted to use this feature
Using the syntax shown in the UserDir documentation, you can restrict what users are permitted to use this functionality:
Enabling a cgi directory for each user
In order to give each user their own cgi-bin directory, you can use a
Allowing users to alter configuration
If you want to allows users to modify the server configuration in their web space, they will need to use .htaccess files to make these changes. Ensure that you have set AllowOverride to a value sufficient for the directives that you want to permit the users to modify. See the .htaccess tutorial for