CodeIgniter Forums
[SOLVED]clean url works on my local machine but not on the live server - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: [SOLVED]clean url works on my local machine but not on the live server (/thread-58348.html)



[SOLVED]clean url works on my local machine but not on the live server - El Forum - 06-05-2013

[eluser]Cgull[/eluser]
Hello,

I am using CI 2.1.2

I have a controller called book in application/controllers/admin/ folder
This controller extends another controller called: Admin_Controller.

In the Admin_Controller:
Code:
function __construct ()
{
  parent::__construct();
  $this->data['meta_title'] = 'ThinklocalCMS';
  $this->load->helper('form');
  $this->load->library('form_validation');
  $this->load->library('session');
  
  // Login check
  $exception_uris = array(
   'auth/login',
   'auth/logout'
  );
  if (in_array(uri_string(), $exception_uris) == FALSE)
  {
   if(!$this->ion_auth->logged_in())
    redirect('auth/login');
   else
    $this->data['username'] = $this->session->userdata('username');
  }
}

I am autoloading the ion_auth library.

In the book controller my index function:
Code:
public function index ($id = NULL)
{
  // Load view
  $this->data['books'] = $this->book_m->get_by(array('publish'=>1));

  $this->data['subview'] = 'admin/book/index';
  $this->load->view('admin/_layout_main', $this->data);
}

In my routes file:
Code:
$route['admin'] = 'admin/book/index';

In my views I have:

views/admin/book/index.php
views/admin/_layout_main.php
views/auth/login.php

My htaccess file in public_html:
Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond $1 !^(index\.php|images|robots\.txt)
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
</IfModule>
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType image/x-icon "access 1 year"
</IfModule>

On my local machine going to: mysite/admin I get the ion_auth login screen.

On the live server, I get page not found:
The page cannot be found
The page you are looking for might have been removed, had its name changed, or is temporarily unavailable.

Please try the following:

If you typed the page address in the Address bar, make sure that it is spelled correctly.
Open the thinklocal.co.za home page, and then look for links to the information you want.
Click the Back button to try another link.

HTTP 404 - File not found
Internet Information Services

Looked everywhere, can't find the problem. Any suggestions what could go wrong? Where should I look?

Thank you



[SOLVED]clean url works on my local machine but not on the live server - El Forum - 06-06-2013

[eluser]Cgull[/eluser]
An update:

I looked at lots and lots of posts about this issue.

Nothing helps Sad

The update is:

If I go to mysite/admin/book I get the login screen, but mysite/admin still gives me Page Not Found.

What the ?????

My routes again:
Code:
$routes['admin'] = 'admin/book';

My folders:
application/conrollers/admin/book.php

public_html/assets

So the application folder outside of the public_html folder, in my index.php file in public_html I have:
Code:
$application_folder = '../application';

What is going on?


[SOLVED]clean url works on my local machine but not on the live server - El Forum - 06-06-2013

[eluser]Cgull[/eluser]
Oh My God !!!

Found the solution!

My public_html folder had an old admin folder in it, and that caused all the problems.

Halleluya !!!!!

Removed this folder, problems solved.