Forum Moderators: phranque
I've tried putting an htaccess file in /www/html, /www/user, and /www with no success. I've also tried putting it in the httpd.conf file. I'm just trying to redirect some old usernames to new ones.
Please help me. :)
From your example URLs, it looks like you're using mod_userdir, so you might want to review the Apache documentation on that module for a start.
Based on what you've written, that's all I can come up with.
Jim
RewriteEngine On
RewriteRule ^([^\.]+[^/])$ /$1/ [R]
RewriteRule ^~jbob/$ /~jimbob/ [R]
Note I also had a wildcard in the 3rd line to catch all files and folers within jbob, but I've taken it out for simplicity and http://www.example.com/~jbob/ should redirect, and it doesn't.
I've also tried it without the ~. The 2nd line makes sure that folders end with a / so that the 3rd line works. I believe the problem is that the server just interprets the ~ and it doesn't need to match on it. Or the problem may be about where I need to put the .htaccess file. But then again, I've tried it without the ~ and in different folders.
I hate the apache documentation too. Any more ideas?
The root problem you're having is likely this:
You are using mod_userdir, as evidenced by the fact that you state that "~" URLs are mapped to subdirectories. This only happens "automatically" if you're using mod_userdir, and is not the default configuration on Apache.
So the problem is that mod_userdir kicks in and maps these "~" URLs to the subdirectories before mod_rewrite ever gets a chance to run, therefore rendering it ineffective.
There are several options, some of which may be available to you on this host, depending on what they allow you to do. In no particular order:
Jim