Part of the EllisLab Network
   
 
[SOLVED] index.php removal instructions aren’t exactly working
Posted: 01 November 2009 12:42 AM   [ Ignore ]  
Grad Student
Rank
Total Posts:  34
Joined  11-01-2009

First of all, I did a search for this type of topic and found a lot of them but nothing seemed to describe my issue.

Yes I have read the User Guide and followed the simple instructions to add this to my .htaccess:

RewriteEngine on
RewriteCond 
$!^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L] 

Simple enough. I tried testing my pages from the blog video tutorial:

http://www.mydomain.com/blog 

It works! Awesome…

But then I notice that when I mouseover my comment links, it wants to take me to this type of url:

http://www.mydomain.com/index.php/blog/comments/1 

Hmmm… I click on those links and thats exactly the URL it takes me to. So apparently the .htaccess rule doesn’t seem to work except for the primary (index) function in the Blog class?

Well I continued reading and looking at threads and found someone discussing a setting in the config.php. So I found this:

/*
|--------------------------------------------------------------------------
| 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"

Oh okay, so I just change it to this:

$config['index_page'""

Sounds like that should work. Now I go back to my blog:

http://www.mydomain.com/blog 

First page comes up easy enough. Mouse over my comment links and I see this:

http://www.mydomain.com/blog/comments/1 

So far so good. I click my comment links and…

Takes me here:

http://www.mydomain.com/blog/comments/1 

EXCEPT its still showing the blog view instead of the comment view…

So I am stumped as to why this isn’t working for me. Any thoughts or hints or can anyone point me in the right direction?

Profile
 
 
Posted: 01 November 2009 02:07 AM   [ Ignore ]   [ # 1 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  880
Joined  07-26-2009

Are you loading the correct view when you do $this->load->view(‘comments’);?

Echo something from your controller to verify where you’re at.

 Signature 

BenEdmunds.com

Contact Me:                                    My Code: 

  ben.edmunds@gmail.com            Github
  @benedmunds

Profile
 
 
Posted: 01 November 2009 02:21 AM   [ Ignore ]   [ # 2 ]  
Grad Student
Rank
Total Posts:  34
Joined  11-01-2009

Here is my comments function

function comments()
    
{
        $data[
'title'"My Comment Title";
        
$data['heading'"My Comment Heading";

        
$this->db->where('entry_id'$this->uri->segment(3));
        
$data['query'$this->db->get('comments');
        
        
$this->load->view('comment_view'$data);
    

I followed the tutorial pretty much to the t.  First of all, should I leave the

$config['index_page'""

or set it back to its default value?

Everything works perfectly just like in the video tutorial until I try to get rid of the index.php.  It’s only then when stuff gets weird.

Profile
 
 
Posted: 01 November 2009 02:35 AM   [ Ignore ]   [ # 3 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  880
Joined  07-26-2009

Yes leave

$config['index_page'""

run php_info() and make sure mod_rewrite is enabled.

 Signature 

BenEdmunds.com

Contact Me:                                    My Code: 

  ben.edmunds@gmail.com            Github
  @benedmunds

Profile
 
 
Posted: 01 November 2009 10:34 PM   [ Ignore ]   [ # 4 ]  
Summer Student
Avatar
Total Posts:  9
Joined  10-23-2009

hi, this site might be helpful… remove index.php

 Signature 

The mind is everything, what you think, what you will become

Profile
 
 
Posted: 02 November 2009 12:37 PM   [ Ignore ]   [ # 5 ]  
Grad Student
Rank
Total Posts:  34
Joined  11-01-2009

Thanks solidlucky,

Those instructions worked perfectly. The trick that did it for me was setting

$config['uri_protocol']    "REQUEST_URI"

It wasn’t working properly until I made that change. This should be in that wiki and in the User Guide imho.

Thanks guys.

Profile
 
 
Posted: 02 November 2009 12:53 PM   [ Ignore ]   [ # 6 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  2126
Joined  06-04-2008
Jakobud - 02 November 2009 05:37 PM

It wasn’t working properly until I made that change. This should be in that wiki and in the User Guide imho.

It’s already in the wiki.  Specifically the FAQ.  Admittedly it’s in the ‘site relocations, moves, changes’ bit - but I’m not sure we need (yet another) discussion about how to work through resolving index.php problems.

I’m open to suggestions on this one.  I feel that the number of forum messages that have a subject that contains the string ‘index.php’, most of which get resolved (even if posters never bother to change the topic-title to include [ SOLVED ] as a matter of courtesy) by fiddling with the uri_protocol is sufficiently high as to make it almost impossible to not discover this trick.

And of course, the config.php file - which you’d have worked through when you installed, presumably - does suggest that the URI PROTOCOL section be revisited if your ‘links do not seem to work’.

Profile