1

(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 http://www.example.com/~user/ but not, as far as I can tell, for http://www.example.com/~user. 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 http://www.example.com/~user 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 http://www.example.com/~user 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 http://www.example.com/~user does not get matched to /home/user/public_html/index.html whilst http://www.example.com/~user/ does.

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

2
  • Do you have any rewrite rules? UserDir should work without the trailing slash. Sep 1, 2011 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.) Sep 2, 2011 at 6:37

0

You must log in to answer this question.

Browse other questions tagged .