0

So I'm setting up a local environment for testing and development. We use CodeIgniter as our framework.

But when I copy the whole server to the local server (I have XAMPP), and navigate to the root, all I see is a directory structure - it doesn't display anything at all that I would expect to see from the website.

I spent 4+ hours (over several days) trying every .htaccess and httpd.conf suggestion I could find on Google, stackoverflow, these forums, and more. I am able to get a 500 server error when adding garbage to the .htaccess file, so I know it's being processed. But I think my problem is possibly unrelated to the .htaccess file settings. (I don't really care if index.php shows up on the URL bar locally.)

There is no index.php on our server's root (again, our site is built with CodeIgniter). Nor anywhere else in the site's directory structure, (except /application/views/user/template/original). When I access the site live, in the URL bar it pulls up the domain name followed by: "/user/login". Looking into the /application/views/user folder shows a login_view.php, but when I try to access it directly, I get an Access Forbidden 403 error.

Per this solution, I also tried changing the DocumentRoot (in C:\xampp\apache\conf\http.conf) from "C:/xampp/htdocs" to "C:/xampp/htdocs/othersites/mysite" Same result.

How is the site loading remotely, but not locally?

Community
  • 1
  • 1
  • 1
    Couple checks you need to do is make sure all Controller file names and class have first letter upper case example Welcome.php and class Welcome extends CI_Controller codeigniter 3 case sensitive now I think –  Oct 24 '15 at 07:35
  • Here are some extra htaccess if you need them https://github.com/riwakawebsitedesigns/htaccess_for_codeigniter –  Oct 24 '15 at 07:40

2 Answers2

0

Check your base_url in config.php

Here is working .htaccess

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

<IfModule !mod_rewrite.c>
  ErrorDocument 404 /index.php
</IfModule>
0

It turns out, for some reason, the site's root index.php wasn't in the git repo that I cloned from. I have that now, along with another (different) .htaccess file.

After changing the base_url in application\config\config.php to my localhost variant, it's working!

If I ever figure out why they didn't have index.php in that repo, I'll let you all know...