views:

33

answers:

1

I am in the process of moving a site to another server and I've ran into a problem.

The site uses .htaccess to redirect to index.php so the index.php can use $_SERVER['REQUEST_URI'] to load the whatever page is being called... However i cannot find where the old server has the .htaccess rules...so I am doing my own.

The .htacess rules I use are:

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ /index.php/?$1 [L,QSA]

the URL is newsiteurl.com/racintv/video_view?channel_id=2

and by printing out the params on the index.php page I am getting

Array ( [page] => racintv/video_view?channel_id=2 )

It should load the video_view page and pass channel_id (which loads a video playlist). This is not the case as it thinks the page to load is actually /video_view?channel_id=2

On the old site, I print out the params on the index.php page it prints

Array ( [page] => racintv/video_view )

and passes the ?channel_id=2 correctly as the video loads correctly

What am I missing in my .httacess that would pass ?channel_id=2 correctly?

Here is the PHP code which parses the URI

$path_info = trim(substr($_SERVER['REQUEST_URI'],1)) ;
$var_array = explode('/',$path_info);
$num_vars = sizeof($var_array);
if ($num_vars==1 or !($var_array[1])) {// in the form of '/foo' or '/foo/'
  if ($var_array[0] && ! strstr($var_array[0],'index')) {
    $var_array[1] = 'index'; // use index as the default page
    $num_vars = 2;
  }
}
if ($num_vars >= 2) { // in the form of '/foo1/foo2[/foo3 ...]'
  $tmp_array = explode('.',$var_array[1]);
  $var_array[1] = $tmp_array[0];
  $page = $var_array[0] .'/'.$var_array[1];
  $vars['page'] = $page;
  $q_str = '';
  for ($i=2;$i<$num_vars;$i++) {
    $key = $var_array[$i];
    $value = $var_array[++$i];
    if ($key && $value) {
      $vars[$key] = $value;
      $q_str .= "$key=$value&";
      $$key=$value;
    }
  }
}

//end of search engine friendly url parsing

A: 

The page parameter is missing:

RewriteRule ^(.+)$ /index.php/?page=$1 [L,QSA]
toscho
That didn't work.. at one point i did try adding the page= and it didn't change anything. thanks though. I did add some more info to my post to help with the problem.. but it still seems to include the ?param=value as part of the module to load.
Sherdog