Question about mode rewrite, I have a php script and .htaccess
RewriteEngine on
RewriteRule ^([a-zA-Z])(.html)$ dictionary.php?action=search&by=$0
RewriteRule ^([a-zA-Z])\/$ /$1 [R]
RewriteRule ^([A-Z]+)([a-z)]+)([0-9)]+)\.html$ dictionary.php?action=search&by=$1&nr_page=$3
RewriteRule ^([^/]+)(.html)$ dictionary.php?action=show&word=$1
now I have text links A, B, C.... that link to A.html, B.html, C.html .... This is done in the php code with
FUNCTION dictMenu( $TE )
{
$menu = 'A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z';
$menu = explode('|', $menu);
FOREACH ($menu as $key => $val) {
$LinkUrl = linkMode ( $val, '?action=search&by=' );
$TE->assign( 'DICT_LINK_' . $val, $LinkUrl);
}
}
//--AND the following function for creating links
FUNCTION linkMode ( $Value, $Uri = '' )
{
$Value = str_replace(' ', '_', $Value );
IF ( DICT_MODE_REWRITE == TRUE ) {
$Url = DIC_URL . $Value . '.html';
}ELSE{
$Url = DIC_URL . FILE_INDEX . $Uri . $Value ;
}
RETURN $Url;
}
So I can change back and forth between mode-rewrite and standard php url with DICT_MODE_REWRITE
I am using a template engine which works great but never did anything with mode rewrite and I don't think it's the problem in this case?
The problem is All the A, B, C Links work just find and I even fetch $_GET[by] and do the query according to the value and display the words listed under it's value.
Now the Issue: the links for the words that come from the query are seem to change. They are linked with hml extentions but when I click on it I no longer have my $GET[by] value set anymore and actually it changes automatically to $GET[word].....
I don't understand this because I didn't tell it to do this in my code and in fact I didn't tell it to do this in the access file either so I guess I just don't underand how the server decides what values are comming from your php script when you don't even set them to something.
When I click on the ABC links the
print_r($_GET) = Array ( [action] => search [by] => S [word] => )
when I click on one of the words generated by clicking on a letter S
print_r($_GET) =Array ( [action] => show [word] => Swingdance [by] => )
At no point in my php did I say $_GET[word] = anything so I'm just very confused on how this actually works if someone could help that would be great.
What I wanted it to do is
print_r($_GET) = Array ( [action] => search [by] => Swingdance [word] => )