Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
i get trailing dot after the domain name on Response::redirect
  • hi, i get an annoying problem when using
    Response::redirect('/login')
    

    [url=http://virtualdomain/]http://virtualdomain/[/url] becomes [url=http://virtualdomain./login]http://virtualdomain./login[/url] and the problem imo is in fuel/core/classes/fuel.php:
    protected static function generate_base()
    {
    ...
     if (\Input::server('script_name'))
     {
      $base_url .= str_replace('\\', '/', dirname(\Input::server('script_name')));
    
      // Add a slash if it is missing
      $base_url = rtrim($base_url, '/').'/';
     }
    ...
    }
    

    script_name is 'index.php', therefore dirname() returns '.' simple fix would be to add the dot in the rtrim but i don't know if it'd break something
    or maybe this isn't really a problem and i have misconfigured the app,
    suggestions?
  • Most likely you configured your base_url in app/config/config.php without a trailing slash. dirname() returns the directory as "./login" and appends it to the trailing-slash-less url [url=http://virtualdomain]http://virtualdomain[/url] which becomes [url=http://virtualdomain]http://virtualdomain[/url]./login
  • Jelmer Schreuder wrote on Monday 24th of October 2011:
    Most likely you configured your base_url in app/config/config.php without a trailing slash. dirname() returns the directory as "./login" and appends it to the trailing-slash-less url [url=http://virtualdomain]http://virtualdomain[/url] which becomes [url=http://virtualdomain]http://virtualdomain[/url]./login

    base_url is null
    Set this to null to have it automatically detected.
    
  • Can you the following in your app (for example in config.php) and email me the result at wanwizard<at>fuelphp.com?
    echo serialize($_SERVER);die();
    
    I can then see if there is something wrong with our autodetect code.
  • Harro Verton wrote on Tuesday 25th of October 2011:
    Can you the following in your app (for example in config.php) and email me the result at wanwizard<at>fuelphp.com?
    echo serialize($_SERVER);die();
    
    I can then see if there is something wrong with our autodetect code.

    i'm using nginx, in /etc/nginx/fastcgi_params file: fastcgi_param SCRIPT_NAME $fastcgi_script_name; => $_SERVER == 'index.php' => dirname('index.php') == '.' (as i mentioned in the first post)
  • Thanks for the email, I haven't had time to check it out. I thought it was an issue in the auto detect code, but you're referring to generate_base_url()? I'll try to find the time tonight.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion