• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Routes not working

Hi all, I cant seem to get my routes to work and think maybe I am missing something somewhere. Instead of going to the right page, it alway

I am using php5 on the server


$route['default_controller'] = "home";
$route['code-([0-9]{1})xx'] = "directorypage/$1";

A page /code-9xx/ should pull the DirectoryPage Control but instead pulls the default_controller.

class DirectoryPage extends Controller {

    function DirectoryPage()
    function index()
    { directory code here.... }

$config['index_page'] = "";

AddHandler application/x-httpd-php5 .php

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    #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
    #This last condition enables access to the images and css folders, and the robots.txt file
    #Submitted by Michael Radlmaier (mradlmaier)
    RewriteCond $1 !^(index\.php|images|robots\.txt|css)
    RewriteRule ^(.*)$ index.php/$1 [L]

<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

[eluser]Phil Sturgeon[/eluser]
$route['default_controller'] = "home";
$route['code-([0-9]{1})xx'] = "directorypage/$1"

This would be trying to load directorypage/9 instead of directorypage/index/9.

I changed this
$route['code-([0-9]{1})xx'] = "directorypage/$1"
$route['code-([0-9]{1})xx'] = "directorypage/index/$1"

and its still routing to the default.

[eluser]Phil Sturgeon[/eluser]
Then you had 2 errors.

Try and take this one step at a time. Does it work without the .htaccess?

if i put in /index.php/code-9xx it works.

And if I remove the .htaccess and use the index.php it works.

This is really frustrating. I have tried
$route['directorypage'] = "directorypage/$1/index";
and still no luck, can anyone point me into the right direction here.
I have a feeling its some setting somewhere.

[eluser]Phil Sturgeon[/eluser]
Is this local or on your dev/production server? I find changing $config['uri_protocol'] to REQUEST_URI often solves this.

Although this solves the problem, I do not want to use REQUEST_URI, but PATH_INFO. Any ideas people?

Well that did it!
So what does this mean, if this worked?

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.