Hello, i need some help with my .htaccess. I setup a *.domain.com subdomain and now i can access the page with any word before it. But i want to rewrite: http://www.sub.domain.com to http://sub.domain.com If its a single subdomain redirecting is no problem but i don't know how to setup my htacces to achieve that for any written word before the domain. (example: sdfsdf.domain.com / game.domain.com / fun.domain.com .... ) Thanks for the help!
Hi, Try the following format. ============== RewriteEngine On RewriteCond %{HTTP_HOST} !^www\.yourdomain\.com$ [NC] RewriteCond %{HTTP_HOST} ^(www\.)?([a-z0-9-]+)\.yourdomain\.com$ [NC] RewriteRule (.*) http://yourdomain.com/$1 [R=301,L] ===============