Trying to route https://some-username.myawesomeapp.dev to https://myawesomeapp.dev/User/get_details/some-username. Could someone please tell me what is wrong with what I'm doing below?
RewriteCond %{HTTP_HOST} ^([a-z0-9-]+).myawesomeapp\.dev [NC]
RewriteRule (.*) /User/get_details/%1 [L]
some-username is dynamic. thanks
I'm working locally using MAMP Pro.
first you have to create a wildcart subdomain
eg: *.yourdomain.com
second add below code to .htaccess
RewriteCond %{HTTP_HOST} !www.yourdomainname.com$ [NC]
RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-]+). yourdomainname.com [NC]
RewriteRule (.*) index.php?page=%2 [NC,QSA]
finally
add php code in index.php
$page = $_GET['page'];
echo $page; exit;