Welcome Guest, Not a member yet? Register   Sign In
Tutorial Routing
#1

Newby

I am painfully working my way through the tutorial, and I am stuck on Routing.  I added the two lines to config/routes.php.  When attempting to go to index.php/about, I get "Forbidden: You don't have permission on this server" or "File not found" depending on which path I include in my URL address.  I am using Mac Mojave.  Please help.
Reply
#2

Post your routes and controllers. I take it you're doing the tutorial.

You should be able to use just /home and /about without the index.php
Simpler is always better
Reply
#3

Yes, I am doing the tutorial.

The tutorial said to add the second and third line below to config/routes.php.

defined('BASEPATH') OR exit('No direct script access allowed');

$route['default_controller'] = 'pages/view';
$route['(:any)'] = 'pages/view/$1';

$route['default_controller'] = 'welcome';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;

Then the tutorial said to go to index.php/about, and I should see the view method in the pages controller.

I added "administrators"  and "all"  to the permissions for the ci directory and all of its contents, and I restarted my Mac to install the new permissions.

I always clear my browser cache before I try a new URL.


I tried the following URL's with the following responses:

1.  http://localhost:8888//ci/index.php/about

"404 Page Not Found
The page you requested was not found."

2.  http://localhost:8888//ci/application/controllers/about

"Forbidden
You don't have permission to access /ci/application/controllers/about on this server."

3.  http://localhost:8888//ci/about

"Not Found
The requested URL /ci/about was not found on this server."
Reply
#4

This is not CI4. Looks like you're using version 3.
Simpler is always better
Reply
#5

(This post was last modified: 06-17-2019, 05:41 PM by ciadmin.)

All your posted examples have double slashes after the port number.
That will definitely cause problems, regardless of the CI version you are using!
Your base_url setting is suspect.
You should never have access to application/controllers from the browser in any case, for "forbidden" is normal.

ps - moving this to "general help", as it does not pertain to CI4.
Reply
#6

He also has two default controllers showing in the routes file.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#7

Thank you very much for alerting me to the existence of CI4.  I downloaded it and while working with it a lightbulb went off.  I received a "You don't have access to this file" and I remembered that a few months ago I deleted my permissions to be an administrator.  Very embarrassing.

Now I am going to contact a company here in the Research Triangle area to see if they can help me restore my administrator permissions on my Mac.  I just don't know enough about using the Mac terminal.

Please shelve this topic for now while I hopefully solve my Mac problem.  I have a feeling that once that is done, I will not need to get back to the forum.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB