I want to rewrite this url http://mydomain.com/client.php?user=om&post=1 to subdomain http://om.mydomain.com/client.php?post=1 The subdomain is already created and i want to show the post of related user through his subdomain url. Please tell me the code for htaccess file.
ugly hack RewriteEngine On RewriteCond %{QUERY_STRING} user=([a-zA-Z0-9_-]+)&post=([0-9]+) RewriteRule ^client.php.* http://%1.mydomain.com/client.php?post=%2 [R=301,L] my personal preference is to route everything to my script and then do with query strings whatever you want