How to rewrite URL with subdomain?

I am developing a site in PHP. I want to provide a unique URL to each user as http:// username.mydomain.com. I want to rewrite this URL to

http:// www. mydomain. com / UserProfile.php ? user=username

But the URL on the address bar should not be changed.

As far as I know I need to configure WildCard DNS. How can I configure this on localhost so that I can test it on local site.

Currently I have configured a single subdomain without wild-card.

and I am using the following .htaccess code for testing

RewriteCond %{HTTP_HOST} ^([a-z0-9]+) \.mydomain.com $ [NC]

RewriteRule ^(.*)$ http://www.mydomain.com/? page=%1 [L,NS]

But it changes the URL on the address bar that I do not want.

Update:

I am using Windows Xp and Apache 2.0 for development.

1 Answer

Relevance
Still have questions? Get your answers by asking now.