Welcome Guest, Not a member yet? Register   Sign In
Moved from local to remote host - Routing Problems
#1

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.
Reply
#2

(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
Romanian CodeIgniter Team :: Translations :: Comunity :: Developers
http://www.codeigniter.com.ro
Reply
#3

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.
Reply
#4

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.
Reply
#5

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

Thanks.
Reply
#6

(This post was last modified: 07-26-2015, 09:15 AM by skunkbad.)

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.
Reply
#7

(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).
Reply
#8

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

Thanks all.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB