Welcome Guest, Not a member yet? Register   Sign In
codeigniter in a subdirectory, some issues.

Hey all,

I am rebuilding a site for a client in codeigniter. Since their original site needs to stay active I am building the new site in a subdirectory. I feel like this may be the cause of my problems, so I'm wondering if there are any special steps I can take to get the site to run properly. My main symptoms are as follows:

for reference, sites url: http://sleepawake.com. I have placed codeigniter at: sleepawake.com/2013/application

1. home controller is loading properly and php is working because the different views are being displayed by the controller. However all of the files I am referencing throughout the page will only resolve if they look like this(for example):


whereas typically I would expect this to work:


Not sure why the structure is all wrong, but it may have to do with the second issue....

2. Only the home controller works, no other controllers are accessible. I simply get a 404 when trying to access. Feel like this may have something to do with phpindex / htaccess or some config.

My index.php is the main culprit. I normally expect to leave the file in the "application" folder. However, when I do that, I dont get my home controller, but instead the site will only load a page that says "index of /2013", and then lists all the files in the root as links:

Parent Directory

when I put the index.php file in the /2013/ folder, the home controller resolves, but I cant access any other controllers and the directory structure of all my files is off.

I feel like my index.php should be in the /2013/application/ folder, but there is another configuration issue that is causing the "index of..." page to display.

Might be confusing, not sure if I covered everything I needed to cover. Have been trying at this for 2 days to no avail, hoping that someone might be able to give me guidance. Any help would really be appreciated.

For reference I'll put my htaccess below. Have also tried all manner of htaccess and config settings, but nothing seems to work. In fact, I have found that my htaccess settings make little difference at all (if any), and that it is mainly the location of my index file that makes/breaks the site.

<IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteBase /2013/
 RewriteCond %{REQUEST_URI} ^system.*
 RewriteRule ^(.*)$ 2013/index.php?/$1 [L]
 RewriteCond %{REQUEST_URI} ^application.*
 RewriteRule ^(.*)$ 2013/index.php?/$1 [L]
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule ^(.*)$ 2013/index.php?/$1 [L]
<IfModule !mod_rewrite.c>
 ErrorDocument 404 ci/index.php

also tried things like:

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

and at some points used some AddHandlers (some instances the browser would try to download 'application/x-httpd-php' when i ping the homepage.)

for config, I tried a number of different URI protocols and base_url settings.

Messages In This Thread
codeigniter in a subdirectory, some issues. - by malokevi - 12-04-2014, 08:32 AM

Theme © iAndrew 2016 - Forum software by © MyBB