I want to dynamically make subdomain. My .htaccess: RewriteEngine On RewriteCond %{HTTP_HOST} !^www\.mysite\.net RewriteCond %{HTTP_HOST} ([^.]+)\.mysite\.net [NC] RewriteRule ^(.*)$ http://www.mysite/content.php?key=%1 [L,R] Code (markup): I want when user come on something.mysite.net to stay in that subdomain and page genarate from http://www.mysite/content.php?key=something It works fine but when you come on something.mysite.net it redirect you to http://www.mysite/content.php?key=something How to stop redirection?
Remove the R (redirect) flag and change the absolute URL to a relative path. For example, if the htaccess file is at mysite.net/.htaccess RewriteRule ^(.*)$ content.php?key=%1 [L] Code (markup): You will probably also need to specify the rewritebase as the root of your domain. Add this line after RewriteEngine On: RewriteBase / Code (markup):