• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
url_suffix problem

#1
[eluser]Lima[/eluser]
I'm using CI 1.7 on Debian etch with Apache 2.0 and PHP 5.2.0

I was developed all page without url_suffix and every thing looks good.
here some url with blank url_suffix :
http://www.mysite.com/rpc/customer from function site_url('rpc/customer')
http://www.mysite.com/site/customer from function site_url('site/customer')

Then I used url_suffix with .html
all my url automatically changed like this :
http://www.mysite.com/rpc/customer.html from function site_url('rpc/customer')
http://www.mysite.com/site/customer.html from function site_url('site/customer')

And my problem is
url http://www.mysite.com/rpc/customer.html return 404 Page Not Found
but http://www.mysite.com/rpc/customer looks good.

Then used url_suffix with _html and everything looks good.

back using url_suffix with .html
Then I try to debug CI_URI class on system/library/URI.php
original function is
Code:
function _remove_url_suffix()
{
  if  ($this->config->item('url_suffix') != "")
  {
    $this->uri_string = reg_replace("|".preg_quote($this->config->item('url_suffix'))."$|", "", $this->uri_string);
  }
}

for debugging I modify the function like this :
Code:
function _remove_url_suffix()
{
  if  ($this->config->item('url_suffix') != "")
  {
    echo $this->uri_string;
    $this->uri_string = reg_replace("|".preg_quote($this->config->item('url_suffix'))."$|", "", $this->uri_string);
  }
}

$this->uri_string result is /site/command_html not /site/command.html

so I modify the function like this :
Code:
function _remove_url_suffix()
{
  if  ($this->config->item('url_suffix') != "")
  {
  $this->uri_string = preg_replace("|".preg_quote(str_replace('.','_',$this->config->item('url_suffix')))."$|", "", $this->uri_string);
  }
}

so it solved my problem.

is anything wrong with my apache or php or CI configuration?

#2
[eluser]Lima[/eluser]
for your information here is some apache variable :
http://www.mysite.com/site/info.html

_REQUEST["/site/info_html"] = no value
_SERVER["QUERY_STRING"] = /site/info.html
_SERVER["REQUEST_URI"] = /site/info.html

I think my problem is from _REQUEST["/site/info_html"] because array index can not contain "." so it replace with "_" by php

is this bugs for CI?

#3
[eluser]Unknown[/eluser]
Hi.
Just few hours ago I had the same problem.
To solve this, you must change uri_protocol value in config.php to this $config['uri_protocol'] = "REQUEST_URI";.
So as I understood the problem is in $_GET array:

if (strtoupper($this->config->item('uri_protocol')) == 'AUTO')
{
if (is_array($_GET) && count($_GET) == 1 && trim(key($_GET), '/') != '')
{
// so if you have in url http://site/main/info.html
// it will produse array: [0] => main, [1] info_html
$this->uri_string = key($_GET);

return;
}
// and if u use REQUEST URI the url will be parsed as needed
if ($uri == 'REQUEST_URI')
{
$this->uri_string = $this->_parse_request_uri();
return;
}


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.