.htaccess remove directory from url

For affiliate tracking purposes, my affiliates have to give out a url like this:

For me, there is no practical reason to send them to the affiliates directory but is required since the tracking application is in there.  The program actually redirects them to my homepage anyway so when they use the above link, they land on www.mydomain.com/

I would prefer to be able to use www.mydomain.com/username instead.   So essentially I just want to write out the "affliates" directory in the url so it appears in root.  

Can I do this with a rewrite in htaccess?  
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Yes you can.
Use the following rule
RewriteRule "/affiliates/(.*)" $1
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mydomain\.com$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) http://www.mydomain.com/$1 [R=301,L]
RewriteRule ^$ affiliates [L]

This will redirect any requests that don't have a matching filename or directory on the server. This way, your site is still navigable but any requests to www.mydomain.com/username or mydomain.com/username will be rewritten to www.mydomain.com/affiliates/username

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Large_FarvaAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Web Server

From novice to tech pro — start learning today.