Forum Moderators: phranque
[edited by: engine at 8:21 am (utc) on Feb 9, 2016]
[edit reason] examplified [/edit]
http://www.example.ca/~username/
RewriteEngine On
RewriteCond %{HTTP_HOST} =www.example.ca [NC]
RewriteRule (.*) http://example.ca/~username/$1 [R=302,L]
Also note: I am using the NC due to the "~" which precedes the URI
RewriteCond %{^~UserName}
The NC flag (short for NOCASE) makes the match case-insensitive.
The .htaccess file is in the proper location.
I have setup numerous redirects on this particular web server in the past.
If you omit the ~ obviously you receive a 404 in your web browser.
My intent in defining RewriteCond %{^~UserName} was to catch all responses beginning with ~ and UserName.
RewriteCond %{REQUEST_URI} ^/~UserName
except that you don't need to say this, because it's already in the body of the rule-- which is exactly where it belongs. I'm guessing you were thinking about modifying the RewriteMap?
<IfModule mod_rewrite.c>