Unable to route to controller within subfolder - CodeIgniter - php

I am new to CodeIgniter.
I am creating an application where I have created controllers within sub folders.
Demo
-Application
-Controllers
- Home
-Left
-Right
-Main
In routes.php, I have added below line.
$route['Left/(:any)'] = 'Home/Left/$1';
This is the URL I am trying to access.
http://localhost/Voyager/left/main
I am getting "404 Page Not Found error".
Is there something else I need to add or change?
Thanks for help.

I found the answer myself.
Issue was that I had another controller in controller folder with name Home, which was causing issue. Renaming that solved the issue.

Related

Error 404 after migrating laravel 8 to a shared host

Hello everyone i am new to laravel and i hope someone can help me about my problem. I created a laravel project. After that I import it to cpanel using softaculous. Then, I made some changes base on what i research in the net to avoid showing important file like .env . I created a folder relative to public_html, let say the folder name is 'tamangbilang' where i put almost all of my code except the index.php. Inside my public_html folder, I have another folder named as 'tamangbilang' where my index.php resides. I have followed this instruction https://dev.to/pushpak1300/deploying-laravel7-app-on-shared-hosting-hostinger-31cj the only difference is that I put another folder inside public_html.I also did some changes on the index.php code
require __DIR__.'/../../tamangbilang/vendor/autoload.php';
$app = require_once __DIR__.'/../../tamangbilang/bootstrap/app.php';
Everything is working fine on my login page(my first page) but when I try to login, an error occur.
The requested URL was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
It seems like the connection between routes was lost. I did further testing and I notice that the code is working well only if there is an index.php, before the route in the url. example
http://my-sample-domain.org/tamangbilang/index.php/login
P.S. I don't have access for ssh.
go to bootstrap folder & open cache folder then delete config. after that please check your routes this error basically arises due to routes not found for that go to your project installed on local and write php artisan route: list check if the route is present or not.

Codeigniter - Url to style.css and media files are correct but nothing is displayed

I've got a huge problem with my codeigniter.
I just moved the codeigniter files to another domain. I've already changed the base_url and the style.css and other media files are implemented with base_url + path_to_the_media_folder.
The path is right, but codeigniter doesn't find my media folder where everything is in. On the other domain this worked totally fine.
Maybe this helps solving the problem:
The folder in which I have the media and css files is located in the same directory as CIs "application", "media", "system", etc. folders.
How can I solve this problem?
Best regards
Paul
Is there any error you are getting? Please share the error
try below URL
http://your domain name/your folder name/index.php/
There is two chance to get the 404 error
1) your path is wrong. 2) There is issue on file name or class name.
Controller class names should be all lowercase, and Controller file name should be Uppercase.
like your class name is
class example extends CI_Controller
and file name is
Example.php
Update: Problem solved
Found out that it was only because I forgot to change the .htaccess (because my new domain had a https connection and the old one not).
Thanks anyone for help.

Laravel5: View [app] not found. resources/views/auth/login.blade.php

I'm using Laravel 5 and I have some problems. When I want to access the login on my subdomain
-> http://dev.miweb.com/auth/login
it says:
ErrorException in FileViewFinder.php line 140: View [app] not found. (View:
/home1/miweb/public_html/subdomains/dev/resources/views/auth/
login.blade.php)
I don't understand what is the problem. For example, if I come in without the subdomain the file is found.
-> http://miweb.com/subdomains/dev/resources/views/auth/login.blade.php
This file is on my host. It is very confusing because it works on my localhost.
Could the problem be caused by the subdomain? What is the solution?
Thank you
As you can see in the source of login.blade.php template, it extends layout which is called app:
#extends('app')
So, probably there's no app.blade.php file in resources/views folder. It should be there in order to display the login form.
I set it as: #extends('layouts.app'). It works well.
I had the same issue I was following the tutorial https://www.flynsarmy.com/2015/02/creating-a-basic-todo-application-in-laravel-5-part-2/ but I created the app.blade.php inside my sub folder. I moved it under the resources/views/ and it worked properly.
set it as: #extends('app')
and then we will get it
in previous versions of laravel..master page i.e app.blade.php was present in views folder but in version 5.4 and in upcoming 5.5 its in the separate layouts folder so now code will be #extends('layouts.app')

Module Routing For Application

I have he following url for my codeigniter application and I'm trying to find out how I can view this specific controller with the url. The my-project is what is used for my cms and the "admin" url segment is a variable representing a section of the cms area, "users" is the module from which I need to get the admin.php file for. I am using the wiredesignz 3rd page HMVC plugin into this application.
testsitehere.com/my-project/admin/users
-application
-modules
-users
-controllers
admin.php
I have tried the following route but still received the 404 error page.
$route['my-project/:any/:any'] = '$1/$2/admin';
What am I doing wrong for it to not work?
Try to use brackets:
$route['my-project/(:any)/(:any)'] = '$1/$2/admin';

CakePHP working on local but can't get it work on production

I have an issue making my cakephp project work on my shared hosting server.
I followed all the needed steps so it can work on local, and it's working. Once I upload on the server, in a specific domain name, only the homepage works, once I want to call another controller, i get the "404 - File or directory not found." error.
the project is hosted at : fme.tahrijouti.com. the domain redirects to the webroot folder in the cakephp structure.
My controller is : posts. I can make it work if I change the URL by specifying the controller & action, you can see it here.
I have checked and the rewrite module is on.
Can you please help me with that ?
Please have a look on CakePHP default routing. And don't forget to fix all your links.
Your links should have proper addresses. Just look on your Posts's link. These are like this http://fme.tahrijouti.com/index.php/posts/posts/view/2 but it should be http://fme.tahrijouti.com/index.php/posts/view/2. Remember after your host name there exist controller then a function of that controller then argument of that function like this: [host]/[controller]/[function]/[argument1]/[argument2]. Hope it helps. I think you can read cookbook another bit as most things are clear there from my experience.
As I don't have your codes of controller I cannot say more.

Categories