Monday 15 July 2013

apache - php $_GET two variables rewirte to subdomain htaccess -



apache - php $_GET two variables rewirte to subdomain htaccess -

i have simple php , htaccess question.

i have $_get :

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

so url :

example.com/index.php?word=test&id=555

now, want convert url :

test.example.com/555/

i have htaccess code :

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

but 1 variable, not both of them.

how can htaccess ?

see if works you:

rewritecond %{http_host} !^www\. [nc] rewritecond %{query_string} ^word=([^&]+)&id=([^&]+)$ [nc] rewriterule ^index\.php$ %{request_scheme}://%1.%{http_host}/%2/ [r=301,l,qsd]

php apache .htaccess mod-rewrite

No comments:

Post a Comment