Is it possible to enable the UserDir Directive for just one VirtualHost rather than have it on for all and then disable it (with "UserDir disable") for each VirtualHost you don't want it on?

I have tried by putting this inside a <VirtualHost> and comment out everything in the global config (/etc/apache2/conf.d/userdir.conf). No luck though.

<IfModule mod_userdir.c>
    UserDir public.www
    UserDir disabled root

    <Directory /home/*/public.www>
            AllowOverride FileInfo AuthConfig Limit Indexes
            Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
            <Limit GET POST OPTIONS>
                    Order allow,deny
                    Allow from all
            <LimitExcept GET POST OPTIONS>
                    Order deny,allow
                    Deny from all
  • You might have missed that LoadModule userdir_module /usr/lib/apache2/modules/mod_userdir.so is required, too. – xebeche Oct 23 '20 at 21:22

I only removed the UserDir public.www (in my case UserDir public_html) from the userdir.conf. Then I added that line to my site configurations where I wanted mod_userdir to be active.

<VirtualHost *:80>
        ServerName userdirs.example.com

        <IfModule mod_userdir.c>
                UserDir public_html
  • This solution seems to work for me (ubuntu 14.04 lts). – nils-holmberg Aug 23 '16 at 14:04

That should work, however there is a defect reported here:


That prevents "normal" merging which is ironically what you're trying to avoid -- maybe because it's not working?

What exactly happens with your current configuration? Is mod_userdir loaded?

  • Agree with @covener. I just had it working. – Wu Yongzheng Aug 16 '13 at 7:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.