I need to create virtual subdomain. For example my site is www.xyz.com i need to have abc.xyz.com were the abc may be the username ... I know we can do this with the help of .htaccess Can anyone help ?
Something like: Options +FollowSymLinks Options +Indexes RewriteEngine On RewriteCond %{ENV:REDIRECT_STATUS} ^$ RewriteCond %{HTTP_HOST} !^www\.yourdomain\.com$ [NC] RewriteCond %{HTTP_HOST} ^(www\.)?([^\.]+)\.yourdomain\.com$ [NC] RewriteRule (.*) /redir/$1 [L] Code (markup): This will redirect any.yourdomain.com to yourdomain/redir/any. You can play with the code a bit if you need to. Also, the \'s in the domain names are required, so don't remove them.
#rewrite conditions RewriteCond %{HTTP_HOST} !^(YOUR_DOMAIN\.com)$ [NC] RewriteRule ^(.*)$ script/index.php?$1 This rewrite rule directs any subdomain requests to a file named /script/index.php on the local server. That script file can use the $_SERVER["QUERY_STRING"] parameter to see what virtual subdomain the request was for and redirect the user correctly, or just provide content for the requested subdomain. The rule as written will redirect all requests with a subdomain, even www, to the script file.
Try this RewriteEngine On Options +FollowSymlinks RewriteCond %{ENV:REDIRECT_MYFLAG} ^$ RewriteCond %{HTTP_HOST} ^([A-Za-z0-9]*)\.site\.com$ RewriteRule ^(.+) %{HTTP_HOST}$1 [E=MYFLAG:1] RewriteRule ^([A-Za-z0-9]*)\.site\.com(.*) /([A-Za-z0-9]*)%{REQUEST_URI} [L] PHP: