CodeIgniter Forums

Full Version: Redirect loop spotted in previous developers code
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Gazzhop[/eluser]
I have taken over from a previous developer, and came across some wierd error. Whenever I change his config page - base url from
Code:
http://localhost/sitex/

to:

Code:
http://{internal ip address}/sitex/

I get a redirect loop. When I change it back, everything works fine, but no one else can access the site (as all links and css references have base_url().

Does anybody know what could cause such errors?

I will happily post any code required...

El Forum

[eluser]@rno[/eluser]
Hi,

You might want to check your .htaccess file for any links back to the original URL

Regards,
Arno

El Forum

[eluser]Gazzhop[/eluser]
Here is the htaccess file.

Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /GENERIC

    #Removes access to the system folder by users.
    #Additionally this will allow you to create a System.php controller,
    #previously this would not have been possible.
    #'system' can be replaced if you have renamed your system folder.
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

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

<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin

    ErrorDocument 404 /index.php
</IfModule>

GENERIC being the folder on the localhost with the site.

Here is the first part of config:

Code:
&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
|    http://example.com/
|
*/
$config['base_url']    = "http://localhost/GENERIC/";

Whenever I replace localhost with the IP address, I get the redirect loop.