Getting 6 possible URL parameters
Your regex could be improved:


$regex = "[^a-zA-Z0-9,-]";
$a = isset($_GET["a"]) ? preg_replace("/".$regex."/", "", $_GET["a"]) : "";



The character , shouldn't be in a URL, but _ can be.
You don't really need to add / to the beginning and end of your regex every time.
I see a lot of people do a-zA-Z when they could really just do a-z with a case insensitive search. 

Becomes:

$regex = "/[^a-z0-9-_]/i"
          ^           ^^
$a = isset($_GET["a"]) ? preg_replace($regex, "", $_GET["a"]) : "";




Using if ($a == "in" &amp;&amp; $aa != null) could probably be improved also as if $aa is not null, then it evaluates to true anyway:

if ($a == "in" &amp;&amp; $aa)




With if ($a == "missinghtml") { $errorUrl = true; }, you should make it into an else if loop

like:

if ($a == "in" &amp;&amp; $aa) { $searchLocation = $aa; }
else if ($a == "missinghtml") { $errorUrl = true; }