Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

(My apologies if this is in the wrong place or has already been asked.)

I've just set up an Apache webserver and am having headaches with UserDir and trailing slashes. The UserDir directive is just:

UserDir public_html

And it works for but not, as far as I can tell, for What seems to happen is that it gets sent to DocumentRoot/~user which then eats it up (the stuff in DocumentRoot has its own set of what-to-dos for files that don't exist, just in case that's important, so as far as Apache is concerned something does something with the request).

Is there a way to make work via mod_userdir, or does it need another level of processing first? If so, what?

Edit: A little experimenting, and comparing with another system where it does work, led me to add the rule:

RedirectMatch /~user$ /~user/

to the .htaccess in user/public_html. So it looks as though the request is getting passed to the user's directory, but then it doesn't find anything to match and so sends it back to the server saying "I can't find anything, take a look in DocumentRoot.". So it seems to be a strange incantation of the "trailing slashes" issue. I had thought to fix trailing slashes with a bit of mod_rewrite trickery, but I couldn't find a set of rules that would match /~user. So the problem appears to be that the request does not get matched to /home/user/public_html/index.html whilst does.

Refined question: Is there a server configuration that will fix this match, or is the RedirectMatch rule the simplest method?

share|improve this question
Do you have any rewrite rules? UserDir should work without the trailing slash. – Pablo Martinez Sep 1 '11 at 22:49
@Pablo: The only configuration thing I did was to change the DocumentRoot. The DR has some fancy stuff in its .htaccess but surely it shouldn't get there because the UserDir should kick in first. (A little more experimenting has led to some new data, but I'll edit that in to the question.) – Loop Space Sep 2 '11 at 6:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.