I am trying to figure something out but I can't seem to get it.
I knwo how to mod_rewrite this is no problem, what I want to have working is something similar to myspace (only usiong them as they the first site that came to my head) where they have myspace.com/username rather than myspace.com/page/username
I can't figur out how they are doing it as their index page is completely different than the userspage.
Anyone help me out as currently I've got it mysite.com/user.php?user=blahblah
I can get it to mysite.com/user/blahblah easy enough but not figuing it out how to mysite.com/blahblah
I'm pretty sure it shouldn't be too hard but my mind is a blank at the moment
I think it's usually done using RewriteCond to check that the requested file does not exist before re-writing to the user page, and also by using + instead of * so that it will only match on strings of at least 1 character (this means that your default index page will not be re-written).
You'll want something like :-
RewriteRule ^([A-Za-z0-9]+)$ user.php?user=$1
Assuming the username can only contain letters and numbers.
Then you'll probably need to use RewriteCond rules to stop that rule being processed for some of your non user pages.
The index page might work, depending on how the rest of your server is set up. For other pages, you could just put them in a folder, which will stop the above rule from matching. A folder called - is what I've seen others use in the past, i.e mysite.com/-/aboutus.