0
votes

I want the subd domain and all parameters after the domain in $_GET variable, so I can grab it in php.


My code in .htaccess :

RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php?site=$1&schule=$2 [L,NC,QSA]


But I don't know how to get the subdomain parameter in $2


If you could explain it to me and give me an example, I would be absolutly thankful to you!

1

1 Answers

0
votes

My solution was: get the subdomain via PHP:

$subdomain = join('.', explode('.', $_SERVER['HTTP_HOST'], -2));

Perfect solution for me.