CodeIgniter Forums
Moved from local to remote host - Routing Problems - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Installation & Setup (https://forum.codeigniter.com/forumdisplay.php?fid=9)
+--- Thread: Moved from local to remote host - Routing Problems (/showthread.php?tid=62534)



Moved from local to remote host - Routing Problems - agrc - 07-25-2015

Hi all,

Just re-joined the forum since things changed here... Hi!

I've immediately ran into a problem with CodeIgniter 3.0 (also haven't touched CI for a few years).

Created a few views, a controller and a few routes to match.

Locally the views are being served as intended and the default controller is also being rendered as it should per my setup.

However, I moved the entire installation to a remote host (typical shared server (mod re-write available)) and problems came immediately.

The default controller returns a 404 and the additional routes I've created return an error message "No input file specified".

I don't know how to fault find this and my host has referred me here. Any ideas?

Thanks in advance.


RE: Moved from local to remote host - Routing Problems - Dracula - 07-25-2015

(07-25-2015, 06:27 AM)agrc Wrote: Hi all,

Just re-joined the forum since things changed here... Hi!

I've immediately ran into a problem with CodeIgniter 3.0 (also haven't touched CI for a few years).

Created a few views, a controller and a few routes to match.

Locally the views are being served as intended and the default controller is also being rendered as it should per my setup.

However, I moved the entire installation to a remote host (typical shared server (mod re-write available)) and problems came immediately.

The default controller returns a 404 and the additional routes I've created return an error message "No input file specified".

I don't know how to fault find this and my host has referred me here. Any ideas?

Thanks in advance.


If your .htaccess looks like this, it should work.

Notice the ? sign after index.php in RewriteRule

PHP Code:
<IfModule mod_rewrite.c>

 
 Options +FollowSymLinks
  RewriteEngine on

  
# Send request via index.php
 
 RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond 
%{REQUEST_FILENAME} !-d
  RewriteRule 
^(.*)$ index.php?/$[L]

</
IfModule



RE: Moved from local to remote host - Routing Problems - agrc - 07-25-2015

I swapped out my htaccess with the one you provided and still no joy. However now it's just returning a 404 on all routes.


RE: Moved from local to remote host - Routing Problems - jessey10237 - 07-25-2015

Keep in mind that since CI 3.0 they use capitals, unlike the previous version of CI.

Besides that, I always recommend using the Htaccess provided by Laravel to ensure that it wont be causing problems.


RE: Moved from local to remote host - Routing Problems - agrc - 07-26-2015

Yes, my models are uppercase. I'll take a look at the Laravel htaccess

Thanks.


RE: Moved from local to remote host - Routing Problems - skunkbad - 07-26-2015

This is what I've been using:


Code:
RewriteEngine On
RewriteBase /
RewriteRule ^(system|application|cgi-bin) - [F,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]

I've also needed slight variations at times:


Code:
RewriteEngine On
RewriteBase /
RewriteRule ^(system|application|cgi-bin) - [F,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# NORMAL SERVER ( COMMENT OUT IF GODADDY OR OPTION #3 )
RewriteRule .* index.php/$0 [PT,L]

# SPECIAL GODADDY LINE ( UNCOMMENT IF GODADDY )
#RewriteRule ^(.*)$ /index.php?/$1 [L]

# IF NOTHING ELSE WORKS UNCOMMENT THIS ONE
#RewriteRule ^ index.php [QSA,L]

If you're not using symbolic links, you can safely remove +FollowSymLinks.


RE: Moved from local to remote host - Routing Problems - mwhitney - 07-27-2015

(07-26-2015, 08:32 AM)agrc Wrote: Yes, my models are uppercase. I'll take a look at the Laravel htaccess

Thanks.

Are your controllers uppercase (or, more accurately, uppercase first letter), with the name of the file matching the name of the class? Models or libraries would have given you errors loading the respective files (maybe only in your logs, but it wouldn't generate a 404), while a 404 indicates that the router couldn't find your controller (file/class name issues) or that your index.php file wasn't found (.htaccess or other configuration issues).


RE: Moved from local to remote host - Routing Problems - agrc - 07-27-2015

It was controllers that were not uppercase. Solved immediately after changing this.

Thanks all.