1

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]

UPDATE

some-username is dynamic. thanks

ANOTHER UPDATE

I'm working locally using MAMP Pro.

lomse
  • 4,045
  • 6
  • 47
  • 68

1 Answers1

0

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;
Geeks Parthiban
  • 114
  • 2
  • 10