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

#1
[eluser]otherjohn[/eluser]
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

Routes.php

Code:
$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.

Code:
class DirectoryPage extends Controller {

    function DirectoryPage()
    {
        parent::Controller();    
        
    }
    
    function index()
    { directory code here.... }

config.php
Code:
$config['index_page'] = "";

.htaccess
Code:
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>

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

#2
[eluser]Phil Sturgeon[/eluser]
Code:
$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.

#3
[eluser]otherjohn[/eluser]
Thanks,
I changed this
Code:
$route['code-([0-9]{1})xx'] = "directorypage/$1"
to
Code:
$route['code-([0-9]{1})xx'] = "directorypage/index/$1"

and its still routing to the default.

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

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

#5
[eluser]otherjohn[/eluser]
if i put in /index.php/code-9xx it works.

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

#6
[eluser]otherjohn[/eluser]
This is really frustrating. I have tried
Code:
$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.
John

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

#8
[eluser]otherjohn[/eluser]
Well that did it!
So what does this mean, if this worked?


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


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