Welcome Guest, Not a member yet? Register   Sign In
mod_rewrite, index.php etc
#11

[eluser]andychurchill[/eluser]
So I now have an empty .htaccess file, my config file now contains:

$config['index_page'] = "index.php";
$config['url_suffix'] = ".htm";

Meaning now all controllers have to be http://mysite.localhost/index.php/controller, or in my case, http://mysite.localhost/index.php/about, which works no trouble, but no surprise, http://mysite.localhost/index.php/about.htm doesn't work. It renders correctly as it always has, but still takes noticeably longer, and shows 404 responses in the http debugging.

I really don't know what is causing this. I've just upgraded the CI system code to 1.7.2. The only other thing I can guess it might be is either my web root structure, or something in my httpd file for apache that is causing it.

* El Forum bangs head against wall.

I think I need to download a sample project containing a working sample of the url suffix in action, to see if it works on my setup, and if not, establish why it isn't.
#12

[eluser]andychurchill[/eluser]
right, I've created a new http://test.localhost/ blank project, added a test controller and view, enabled the .htm suffix, same .htaccess as before, and that works. Going to recreate my new site's folder structure now, and see if that has an impact. I'll figure it out eventually!
#13

[eluser]tomcode[/eluser]
Ok, I've done a fast test :

config.php:
Code:
$config['url_suffix'] = ".htm";

routes.php
Code:
$route['default_controller'] = "welcome";
$route['scaffolding_trigger'] = "";
$route['our-equipment'] = "OurEquipment";

controllers :
welcome.php
about.php
OurEquipment.php

I can reach the following URL's :

http://localhost/CodeIgniter_1.7.2_suffix/
http://localhost/CodeIgniter_1.7.2_suffix/index.php
http://localhost/CodeIgniter_1.7.2_suffix/index.php/welcome
http://localhost/CodeIgniter_1.7.2_suffix/index.php/welcome.htm
http://localhost/CodeIgniter_1.7.2_suffix/index.php/about
http://localhost/CodeIgniter_1.7.2_suffix/index.php/about.htm
http://localhost/CodeIgniter_1.7.2_suffix/index.php/our-equipment
http://localhost/CodeIgniter_1.7.2_suffix/index.php/our-equipment.htm
#14

[eluser]andychurchill[/eluser]
I think I've actually discovered the cause.

I now have a blank project - copied all my controllers back over, css, imgs, js, etc, and the wordpress blog folder that sits under public_html. everything is working as expected. it was at this point that I then realised that I've actually modified the index.php file so that I could access blog posts in the codeigniter homepage view. See this thread for the inspiration for this: http://ellislab.com/forums/viewthread/48347/

What I'd done is added:

require('blog/wp-blog-header.php');

at the very top of the index.php page, just before the error reporting level is set. This enabled me to pull the most recent blog post details and display them in my home controller. query_posts is a WP function, basically hands over the functionality of reading from the DB back to WP.

$blog = query_posts(array('showposts' => 1));
$blogdata['blogTitle'] = $blog[0]->post_title;
$blogdata['blogExcerpt'] = $blog[0]->post_excerpt;
$blogdata['blogURL'] = $blog[0]->guid;

$this->load->view('home_view', $blogdata);

But I guess it's this that is causing the problem! I think this is the only reason I put that line in the index.php, so if I re-write this bit of code, perhaps to manually pull the content, (or perhaps see if someone already did a Wordpress Library for CI?) then it should achieve the same thing without needing the require_once line in the index.php!
#15

[eluser]tomcode[/eluser]
Guess You better start a new thread with that question.




Theme © iAndrew 2016 - Forum software by © MyBB