trailing slash in $config['base_url'] and start slash in redirect()

In configuration,

URL to your CodeIgniter root. Typically this will be your base URL, WITH a trailing slash:
$config['base_url'] = "";

In document


if ($logged_in == FALSE)
redirect('/login/form/', 'refresh');

// with 301 redirect
redirect('/article/13', 'location', 301);

My questions are:

1) the base_url already have a slash and the end, does redirect() needs a slash at the beginning? Is that duplicated? Or better practice is with or without start slash in redirect(), someone said need the start slash someone said no. What is the authenticate answer? Thanks!

2) It seems CodeIgniter already takes care of the case that if $config['base_url'], missing the trailing slash. Such as with or without trailing slash, base_url() would always return with trailing slash. What is the common error you can see if missing the trail slash in the $config['base_url']?


I never use a beginning slash in redirect (or ending one for that matter). It doesn't seem to make any difference. Without digging through the core, I believe that it checks for and adds/removes the slash if needed.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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