Jeff Davidson
Jeff Davidson

Reputation: 1929

CI not working locally

Instead of working live on my site I've decided to try and work locally and install new version later on my live site.

So I'm working with Codeigniter and have the following struture.

/htdocs/kow(site)/kowmanager(cms)

When I load https:localhost/kow it loads the correct controller however for some reason its not reconizing that kowmanager is a sub directory of kow with its own application folder and it should be loading the default controller that is set in its routes file. When I load https://localhost.com/kow/kowmanager it loads a page that says index of /kow/kowmanager and then a link to the parent directory. Which isn't anything CI related.

Inside the kow directory this is my .htaccess file. Is this the problem?

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]

RewriteEngine On
RewriteBase /kowmanager
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]

I'm using xxamp.

Upvotes: 0

Views: 133

Answers (3)

Zombaya
Zombaya

Reputation: 2258

You need an index.php-page for each application as stated by the manual.

So I think you should copy your index.php to indexManager.php and in it change the application folder.

$application_folder = "kowmanager";

About the rewrite I am not sure but I think it is in line with:

RewriteEngine On
RewriteBase /kowmanager
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ indexManager.php?/$1 [L]

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]

Upvotes: 1

Andy Groff
Andy Groff

Reputation: 2670

What is in kowmanager and why do you have two rewrites? If your directory structure is how I assume it is, you might get away with just removing the second kowmanager directive from your .htaccess file.

Which folder is codeigniter in? All you want to do is rewrite the url to remove index.php, but unless you're mapping the url to codeigniter's index.php, it will never be able to load controllers.

Apache has a lot of info on url rewrite. Its a lot of reading and the behavior is always pretty finicky, but maybe it will help you:

Otherwise, more info will help us help you. P.S. I'd also tag this with apache, as that is where the problem is, and you're more likely to get people who know a lot about apache to view your question.

Upvotes: 1

AchrafSoltani
AchrafSoltani

Reputation: 216

are you using a .htaccess to remove index.php from urls ? is /htdocs/kow the base directory of your project where CI is installed ?

you need to put kowmanagers in the controllers directory, and specify which controller to call, I'm not sure CI supports calling default controllers from directories unless you specify it in the routes.php config file.

Anyway, please give further information if you want a precise answer.

Upvotes: 1

Related Questions