Hi, I have a site with the following pages (already done with mod-rewrite): www.site.com/home www.site.com/search www.site.com/about I also want to allow a user to have their profile at, for example: www.site.com/username from www.site.com/profile.php?user=x How can I do this with mod-rewrite, thanks.
How can i set a condition which checks if the url is NOT the root URl. I tried this and It doesnt work: RewriteCond %{http_host} !^http://www.site.com/ [nc] Suggestions? Thanks!
To see if the URL is not on the root domain you have to do it without the http:// so that condition would be: RewriteCond %{HTTP_HOST} !^www\.site\.com$ Code (markup): You can redirect the user names by adding: RewriteRule ^([a-z]+)$ /profile.php?user=$1 [L] Code (markup): After the other rules.
Ok it's not working, here is my code: RewriteCond $1 !^home RewriteCond $1 !^about RewriteCond $1 !^signup RewriteCond $1 !^contact RewriteCond $1 !^signin RewriteCond $1 !^index2\.php RewriteCond %{HTTP_HOST} !^www\.site\.me$ RewriteRule ^([^/]+)$ profile.php?user=$1 [L] When I add the last condition, www.site.me/FOO , shows a 404 not found, instead of the contents of the profile.php file. Any help very much appreciated, Jake.
I believe the problem is that the condition is www.site.me AND anything which is following this. However I only want it to limit it to the root domain, when the URI is www.site.me thanks