Welcome Guest, Not a member yet? Register   Sign In
URLs don't work
#1

[eluser]Ñuño Martínez[/eluser]
Actually I have no idea about how to name this problem.

Just the URLs don't work. Let me explain.

I was using CI for about two years in some projects and have few problems but always I could fix them.

Today I've started a new project, but I did download version 1.7.2 (we were using 1.7.1 :roll: ) and it just doesn't work. If I don't change the configuration (except the 'base_url') it shows the Wellcome message, but if I try to use my own controller it only works if I request the "index.php" file: anything else return a 404 error!

My .htaccess file:
Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

The ONLY line I've changed at system/application/config/config.php:
Code:
$config['base_url']    = 'http://localhost/segur/';

The ONLY line I've changed at system/application/config/routes.php:
Code:
$route['default_controller'] = "principal";

I changed the database configuration too.

My controller (actual code as I've saved at "application/controllers/principal.php"):
Code:
class Principal extends Controller
  {
  ## Si recibe parámetros, comprueba la identificación.  Si no es una
  ## identificación válida o no recibe parámetros, muestra la pantalla de
  ## identificación.
    public function identificarse ()
    {
      echo "<h1>Identificándose</h1>";
    }



  ## Pantalla principal de la aplicación.
    public function index ()
    {
    ## Comprueba que se haya identificado.
      echo "<h1>Here we're!</h1>";
    }
  }

Now, with this configuration, if I write in the URL "http://localhost/segur/" I get:

Code:
Not Found

The requested URL /index.php/ was not found on this server.
Apache/2.2.12 (Ubuntu) Server at localhost Port 80

And trying to load "http://localhost/segur/identificarse/" it returns:

Code:
Not Found

The requested URL /index.php/identificarse/ was not found on this server.
Apache/2.2.12 (Ubuntu) Server at localhost Port 80

Now, if I delete the .htaccess file and try "http://localhost/segur/" or "http://localhost/segur/index.php" it returns:

Code:
Here we're!

But if I try "http://localhost/segur/index.php/identificarse" it returns:

Code:
404 Page Not Found

The page you requested was not found.

I did try modifying the configuration line: "$config['index_page'] = "index.php";" adding the "?" character as documentation suggested but I have same results.

[edit]

I found a mistake: "http://localhost/segur/index.php/principal/" and "http://localhost/segur/index.php/principal/identificarse" do actually works, but everything else doesn't. :-S

[/edit]

BTW, "/var/www/segur" is a symbolic link to the actual working directory (both in the same computer).

Also the other applications we create with version 1.7.1 work as expected, in the same computer, with similar .htaccess files and configuration parameters.

[edit]

Sorry about the mistake. My fault. Sad
#2

[eluser]Raphael Passini[/eluser]
Try to put this:

Code:
RewriteEngine on
RewriteBase /path/to/codeigniter/
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]




Theme © iAndrew 2016 - Forum software by © MyBB