• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
index.php being written out of URLs

#1
[eluser]Unknown[/eluser]
Hey all,

Bit of a curious problem this - never encountered anything like it before. It would appear that codeigniter is rewriting my URLs, removing index.php, even though I've specified the index page in the config.

First thought was that it might be a stray .htaccess file in my root but after renaming it the problem is still occurring.

The relevant part of my config file:
Code:
<?php
/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
|    example.com/
|
| If this is not set then CodeIgniter will guess the protocol, domain and
| path to your installation.
|
*/
$config['base_url']    = '//localhost/baby-cow/';

/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = 'index.php';

?>

Am I right in thinking that the config above should generate URLs like:
Code:
localhost/baby-cow/index.php/site/latest_episode/

Currently it does them like this:
Code:
localhost/baby-cow/site/latest_episode/

However, if you put the index.php in manually it works fine.

My Apache logs have this error:
Code:
[Fri Jun 03 08:30:15 2011] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/baby-cow/site, referer: localhost/baby-cow/

Furthermore, if I add my .htaccess back in but don't remove index page from the config it still generates URLs like:
Code:
localhost/baby-cow/site/latest_episode/
However they resolve correctly.

Can anyone shed some light on my situation?

(removed http:// from urls because your spam filter was stopping me from posting)

Many thanks,
Ralph

#2
[eluser]Seb[/eluser]
Hello,

Code Igniter does not parse the .htaccess files to rewrite URLs. Therefore, I suggest you might look in another direction.

Maybe you have :

Code:
$config['index_page'] = ''

in some other configuration file...

#3
[eluser]InsiteFX[/eluser]
Code:
$config['base_url']    = '//localhost/baby-cow/';

// should be:
$config['base_url']    = 'http://localhost/baby-cow/';

InsiteFX

#4
[eluser]Unknown[/eluser]
Quote:(removed http:// from urls because your spam filter was stopping me from posting)

Now made that line bold so it stands out a bit more - sorry for the confusion.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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