mysql - php $_GET item to virtual subdomain with Htaccess -



mysql - php $_GET item to virtual subdomain with Htaccess -

i have simple question related php , htaccess.

just think have php code :

if(isset($_get['word'])) { echo $_get['word']; }

so have (for example) :

example.com/?word=test

and code echo out **test**, question that,

how can alter $_get value, virtual subdomain ?

for example, want have this, if below address opened :

test.example.com

then code gets run , echo out **test**.

i need htaccess code thing, so, how can htaccess ?

i have tried codes couldn't results .

you can utilize code in document_root/.htaccess file:

rewriteengine on rewritecond %{http_host} !^www\. [nc] rewritecond %{http_host} ^([^.]+) [nc] rewritecond %{query_string} !(?:^|&)word=[^&]+(?:&|$) [nc] rewriterule ^ %{request_uri}?word=%1 [qsa,l]

%1 reference value captured in line: rewritecond %{http_host} ^([^.]+) [nc] first part of domain name before dot.

php mysql .htaccess subdomain echo

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -