I've been at this all day and I thought I had a handle on regular expressions but I'm no longer confident that I do. I've searched all over, read through some horrible guides on mod_rewrite and I'm stumped.
I want to make it so that the call
subdomain.domain.com/u/satbirkira
looks exactly like the above, but executes and displays this instead
domain.com/user.php?user_name=satbirkira?subdomain_given=subdomain
It should be extremely simple but I can't get it. Here's what I came up with:
RewriteCond %{HTTP_HOST} ^(.*)user.php\?user_name=(.*)$ [NC]
RewriteRule ^(.*)$ http://%1%{REQUEST_URI}/u/$3
I have no idea why some RewriteCond break if you remove useless capture points like the first (.*) but I've learned to just roll with it. I would appreciate it if someone would explain why the approach is incorrect, syntax, capture points and the replacement as well as variables.
Edit
Its similar to the goal on #4 on http://roshanbh.com.np/2008/03/url-rewriting-examples-htaccess.html, "4) Rewriting yoursite.com/user.php?username=xyz to yoursite.com/xyz" expect the answer makes no sense to me.