i'm using CodeIgniter 4 and having trouble creating a route
I have this url
/Show/post/100008
But I want to route it to this
/post/100008
I've tried
$routes->get('/post/(:num)', 'Show::post/(:num)');
but i'm getting 404 error when typing /post/100008 url only
Is the route correct or is there any other solution for it?
Thank you
The solution is by changing the line to
$routes->get('/post/(:num)', 'Show::post/$1');
Codeigniter 4 URI Routing docs : https://codeigniter.com/user_guide/incoming/routing.html
Related
I'm using laravel 6 and for some reason when using Route::get('/','HomeController#Index') I get 404 not found error but any other urls like Route::get('/home','HomeController#Index') works just fine.
In Laravel 5.2 docs about Implicit route model binding, there is written:
If a matching model instance is not found in the database, a 404 HTTP
response will be automatically generated.
Route:
Route::get('/product/{product}',function(Product $product){
dd($product);
});
When I enter into URL parameter existent ID, everything works as expected. But when I enter into URL nonexistent product ID, I got No query results for model [App\Product]. instead of response 404. Any ideas why?
After searching i found out solution. If you have no specified error template files in resources/views/errors default Laravel message will be shown. Just create 404.blade.php file in resources/views/errors.
I'm using Laravel 4.2 framework for my website, and want it catch my 404 error correctly. My problem is that the server return a different 404 page when I try to open some bad link inside the public folder. Please give me some advice, thank you very much.
Folder structure:
-- app
-- bootstrap
-- public
--assets
--packagespage
-- vender
Normally, I set my 404 page like this:
When I tried http://localhost:8000/assets/some-name and http://localhost:8000/packages/some-name => new 404 page here:
i am using , https://github.com/blueimp/jQuery-File-Upload plugin for image upload using ajax call in laravel 5. i also refered article http://peterjolson.com/using-laravel-and-jquery-file-upload/. but i am getting the following error error
GET http://localhost:8000/...../server/php/ 500 (Internal
Server Error)
when i use https://github.com/blueimp/jQuery-File-Upload/wiki/Basic-plugin i get the same error. Can anyone help with this or please suggest any working image uploader with ajax call for laravel 5
There is a main.js file, you need to adjust the url there according to the path you store it:
url: '../../uploadimage/server/php/'
I am working in netbeans
I've controller named Cms with a function signup in which I load the view as
$this -> load -> view('cms/signup');
and view is on the followoing location
D:\xampp\htdocs\CMS\application\views\cms
in the routes.php I've defined the following route to access this view
$route['aaa'] = 'cms/signup';
when I type the following URL http://roz.com/cms/aaa it says CI error message "page not found" yesterday it was working. default controller is working fine without index.php with following URL 'http://roz.com/cms'
please advice where the problem lies actually. I am working on localhost