How does URL rewriting affect the $_GET
parameter for PHP?
Say I have a URL like http://example.com/index.php?p=contact
and I use $_G
In your case it wouldn't work. mod_rewrite, after it finds a match and rewrites http://example.com/index.php?p=contact to http://example.com/contact, does an internal redirect. Even after the redirect, the new, redirected URI, can still be matched against a condition and further redirected.
In any case, incoming URIs aren't kept in memory, so not even Apache can reconstruct what the original URI was. PHP, by the time it's executed, also doesn't know the original URI. Hence, you loose your $_GET vars, as variables sent via GET are contained in the URL, which was, by now, transformed, and PHP populates the associative $_GET array by parsing incoming requests.
Offering support for both would be painstaking. If you have http://domain.com/segment1/segment2/segment3 you have to associate the segments with something meaningful. You'd strip your domain and explode on '/', and in your case you could say that the first segment requests the page, and from http://example.com/contact/ you can extract page = 'contact'