Welcome Guest, Not a member yet? Register   Sign In
Forced to explicitly declare all routes
#1

[eluser]Media Gearhead[/eluser]
I recently inherited a CI 1.7.1 site and upgraded it to 2.0.2
This specific issue has been happening since 1.7.1 and continues in 2.0.2
The short of it is that I am forced to declare every route or it will fail to load.

For example if I was to visit /live/live2 I get a for yet I have a controller of Live and a method of live2. This happens on other links as well.

In some instances I can set a route to make it work and sometimes even setting a route like the one below fails.
$route['live/live2'] = "live/live2";

What makes this more perplexing is that when I am doing local dev on XAMPP it works fine. Yet remotely on the live server it fails with a 404.

Has anyone seen a similar issue?
Any thoughts would be helpful.
#2

[eluser]Aken[/eluser]
Do you have an .htaccess file on the live server?

Are you receiving a 404 error? If so, is it generated by CodeIgniter or the server?
#3

[eluser]Media Gearhead[/eluser]
I am getting the CI 404 page and the following response headers through FireBug.

HTTP/1.1 404 Not Found
Date: Sat, 13 Aug 2011 13:57:34 GMT
Server: Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 PHP/5.2.9
X-Powered-By: PHP/5.2.9
Cache-Control: max-age=600, private, must-revalidate
Expires: Sat, 13 Aug 2011 14:07:34 GMT
Content-Length: 539
Keep-Alive: timeout=5, max=86
Connection: Keep-Alive
Content-Type: text/html
#4

[eluser]Media Gearhead[/eluser]
Also now it seems to be throwing the error on my local setup (XAMPP) as well as live (cPanel/Apache)
#5

[eluser]Media Gearhead[/eluser]
[quote author="Aken" date="1313239994"]Do you have an .htaccess file on the live server?[/quote]

Right forgot that part. Yes I do.
This is the current one.
Code:
RewriteEngine On
<ifModule mod_deflate.c>
  <filesMatch "\.(css|js|x?html?|php)$">
    SetOutputFilter DEFLATE
  </filesMatch>
</ifModule>
# BEGIN Expire headers
<ifModule mod_expires.c>
  ExpiresActive On
  ExpiresDefault "access plus 1 seconds"
  ExpiresByType image/x-icon "access plus 2592000 seconds"
  ExpiresByType image/jpeg "access plus 2592000 seconds"
  ExpiresByType image/png "access plus 2592000 seconds"
  ExpiresByType image/gif "access plus 2592000 seconds"
  ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
  ExpiresByType text/css "access plus 604800 seconds"
  ExpiresByType text/javascript "access plus 216000 seconds"
  ExpiresByType application/javascript "access plus 216000 seconds"
  ExpiresByType application/x-javascript "access plus 216000 seconds"
  ExpiresByType text/html "access plus 600 seconds"
  ExpiresByType application/xhtml+xml "access plus 600 seconds"
</ifModule>
# END Expire headers

# BEGIN Cache-Control Headers
<ifModule mod_headers.c>
  <filesMatch "\.(ico|jpe?g|png|gif|swf)$">
    Header set Cache-Control "max-age=2592000, public"
  </filesMatch>
  <filesMatch "\.(css)$">
    Header set Cache-Control "max-age=604800, public"
  </filesMatch>
  <filesMatch "\.(js)$">
    Header set Cache-Control "max-age=216000, private"
  </filesMatch>
  <filesMatch "\.(x?html?|php)$">
    Header set Cache-Control "max-age=600, private, must-revalidate"
  </filesMatch>
</ifModule>
# END Cache-Control Headers

# BEGIN Turn ETags Off
<ifModule mod_headers.c>
  Header unset ETag
</ifModule>
FileETag None
# END Turn ETags Off

# BEGIN Remove Last-Modified Header
<ifModule mod_headers.c>
  Header unset Last-Modified
</ifModule>
# END Remove Last-Modified Header
<IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /

        #Checks to see if the user is attempting to access a valid file,
        #such as an image or css document, if this isn't true it sends the
        #request to index.php
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

I have also had just the rewrite but that fails too...
Code:
<IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /

        #Checks to see if the user is attempting to access a valid file,
        #such as an image or css document, if this isn't true it sends the
        #request to index.php
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
#6

[eluser]Aken[/eluser]
What routes do you currently have set up?

Also, try removing your .htaccess and set your index_page to index.php again - that way you can verify that everything works and .htaccess is not making anything worse, then you can add it back in when you're done. Just what I would do.




Theme © iAndrew 2016 - Forum software by © MyBB