I would like to redirect my wildcard subdomain to my main domain using the subdomain as a GET parameter in the URL using .htaccess
Example of what I would like to happen:
billy.example.com
redirects to
www.example.com/profile?user_name=billy
Here is the current rule I have put together based on other answers on this site. However, when the redirect happens I get the following URL with a "Redirect Loop" error:
www.example.com/profile?user_name=www
RewriteCond %{HTTP_HOST} ^(.*).example.com
RewriteRule ^(.*)$ http://www.example.com/shop?user_name=%1 [R,L]
I've seen this answered a few different ways on this website but unfortunately none of them worked for me. Any help would be appreciated. Thank you
Details: I'm using PHP, and i have setup * as a subdomain in my hosting panel.