Laravel quick start guide route return 404 - laravel-4

So I am a new Laravel user,I just went straight to the documentation to get started.but I get a question:
In app/routes.php,I write like this:
Route::get('users',function() {
return 'hello';
});
Route::get('/',function() {
return View::make('hello');
});
When I hit
127.0.0.1/aerial/public/
it works fine;When hit:
127.0.0.1/aerial/public/index.php/users or 127.0.0.1/aerial/public/users or localhost/aerial/public/index.php/users
it returns 404;My environment nginx.

You should probably convert your .htaccess file in public directory to nginx format and make sure you have mod rewrite (or nginx module used for that) enabled

Related

iam new to laravel 8 Iam creating Routes and they generate an error

am creating route in laravel-8 only one route is working and the others are not why
Routes problem
Route::get('/', function () {
return view('dashboard');
});
only the '/' the first route working and the other 2 which are below are not working. when want to access on teh screen shows that
404 NOT FOUND.
please some one help me.
Route::get('/allProducts', function() {
return "view('products');";
});
Route::get('contact',function(){
return "hello ";
});
First of all, make sure your URL is correct. According to Laravel 8 documents, you have to display it this way. If this problem persists, check your web server configuration.
Route::get('/allProducts', function () {
return view('dashboard');
});
To see which routes are set up run the following form command line.
php artisan route:list
start a development server by running the following in your command line
localhost:8000/allProducts

Laravel Catch Any Route with Prefix?

So currently in my Laravel app I've got the route;
Route::get('/{any}', 'SinglePageController#index')->where('any', '.*');
And in this state, it works. However I want to add a prefix to it such as /app/{any} and for it to be inclusive of app as well. So /app would still go to SinglePageController.
I've tried doing something like that and it works for everything except the /app route itself.
Hopefully someone can provide some suggestions.
Try this:
Route::group(["prefix" => "app"], function(){
Route::get('/{any?}', 'SinglePageController#index');
}
I converted the any parameter to optional, so it can go to SinglePageController#index when it's not given too.
Also you may define the parameter of the index method as optional too. Like:
public function index($any = null){

Laravel passing all routes for a particular domain to a controller

Working on a Laravel 4.2 project. What I am trying to accomplish is pass every URI pattern to a controller that I can then go to the database and see if I need to redirect this URL (I know I can do this simple in PHP and do not need to go through Laravel, but just trying to use this as a learning experience.)
So what I have at the moment is this:
Route::group(array('domain' => 'sub.domain.com'), function()
{
Route::get('?', 'RedirectController#index');
});
I am routing any subdomain which I deem as a "redirect subdomain" ... The ? is where I am having the problem. From what I have read you should be able to use "*" for anything but that does not seem to be working. Anyone have a clue how to pass any URL to a controller?
And on top of that I would ideally like to pass the FULL URL so i can easily just check the DB and redirect so:
$url = URL::full();
Try this:
Route::group(array('domain' => 'sub.domain.com'), function()
{
Route::get('{path}', 'RedirectController#index')
->where('path', '.*');
});
And your controller will reseive the path as first argument
public function index($path){
// ...
}
In case you're wondering, the where is needed because without it {path} will only match the path until the first /. This way all characters, even /, are allowed as route parameter

Laravel 'Whoops' error in Public after fresh Install

I installed Laravel locally on MAMP and navigated to the correct localhost location, and for some reason am getting Whoops, looks like something went wrong.
The route.php looks fine:
Route::get('/', function()
{
return View::make('hello');
});
Here is the error I'm getting:
base64_decode() expects parameter 1 to be string, array given
Apparently it's caused by this (arrow) in /bootstrap/compiled.php:
protected function getJsonPayload($payload)
{
----> $payload = json_decode(base64_decode($payload), true);
if (!$payload || $this->invalidPayload($payload)) {
throw new DecryptException('Invalid data.');
What am I missing in my new install to make this work?
You should give write permissions (777) to app/storage folder, also try to define debug as true in app/config/app.php to check what is going on.
You try -> go to url you want-> in here you clear cookie.
if chrome: F12 -> Resources -> Clear Cookies here.

Joomla 2.5 - Disable www.[websitename].com/?format=feed&type=rss

I have been searching forever trying to find a way to disable the feed link (ie: www.[websitename].com/?format=feed&type=rss).
Is there a way to disable this link? I have some bad google indexes of these and I want to return 404 not found when google tries to index them again.
Try editing the libraries/joomla/document/feed/feed.php file.
Find __construct method of JFeedDocument class in the file and change it to look like this:
function __construct($options = array()) {
JError::raiseError(404, JText::_('Resource Not Found'));
}
But, in this case, you won't have "feed" support at all.
Just in case someone is out there looking for this, what worked for me was setting 404 Not Found headers in the JDocumentFeed constructor:
function __construct($options = array()) {
if (!headers_sent()) {
header('HTTP/1.0 404 Not Found');
//I guess you could include here a file to show the 404 page
}
exit();
}
The call for JError::raiseError(404, JText::_('Resource Not Found')); gave me a backtrace of the error.

Resources