Hi,
I am trying to create a RewriteRule for my site. I got the first part correctly. This means say /index.php?mid=#. This passes correctly.
Here is the example: http://www.orchot-hagilboa.com/דף_הבית
But how do I add another param?
Say I am passing /index.php?mid=#&smid=# ????
Here is my rewriterule in htaccess:
Options +FollowSymlinks
RewriteEngine On
#RewriteCond %{REQUEST_URI} !img/(.*)$
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ /index.php?q=$1 [L]
Here is what i do with the params:
//preparing query chunks
$url = $_GET['q'];
$url = str_replace('_', ' ', $url);
$urlChunksInitial = explode('/', $url);
$urlChunks = array_reverse($urlChunksInitial);
//processing mid chunk
if (isset($urlChunks[0]) && ($urlChunks[0] != '')) {
$midTitle = $urlChunks[0];
$midQuery = mysql_query('SELECT menu_id, title FROM menu WHERE title = \'' . $midTitle . '\'')
or trigger_error('Query: ' . $midQuery . '\n<br />MySQL Error: ' . mysql_error());
if (mysql_num_rows($midQuery) > 0) {
$midRows = @mysql_fetch_array($midQuery);
$mid = $midRows[0];
$menuTitle = $midRows[1];
$menuUrl = '/'.$midRows[1];
}
} // if ($urlChunks[0] != '')
// processing smid chunk
if (isset($urlChunks[1]) && ($urlChunks[1] != '')) {
$smidTitle = $urlChunks[1];
$smidQuery = mysql_query('SELECT smenu_id, title FROM smenu WHERE title = \'' . $smidTitle . '\'')
or trigger_error('Query: ' . $smidQuery . '\n<br />MySQL Error: ' . mysql_error());
if (mysql_num_rows($smidQuery) > 0) {
$smidRows = @mysql_fetch_array($smidQuery);
$smid = $smidRows[0];
$smenuTitle = $smidRows[1];
$smenuUrl = '/'.$smidRows[1];
}
} // if ($urlChunks[1] != '')
Please help!!! :)