by Devin Yang
(This article was automatically translated.)

Published - 7 years ago ( Updated - 7 years ago )

foreword

Especially for friends who are studying SEO, you should know that sometimes we need to redirect 301 pages, which is provided in Laravel 5.5
The function of Route::redirect is quite simple. In addition, using Route::view is also very useful for the layout of static pages.

Redirect Routes

The syntax is very simple, we can easily use Route::redirect for 301 redirection.
Route::redirect('/oldpage','/newpage');

View Routes

I don’t know if you have ever touched the template, but in fact, most of the entire website are static pages, only a few dynamic pages.
It is no longer necessary to build a Controller for each page, or to display it through a function return view.
We have an easier way to handle it through Route:view .
Route::view('/welcome', 'welcome', ['title' => '3C Tech Center, CCC']);
 
The first parameter is URI, and the second parameter is the name of the view. Of course, we can also provide the third optional parameter to send the Array to the View. Cool!!

Tags: laravel

Devin Yang

Feel free to ask me, if you don't get it.:)

No Comment

Post your comment

Login is required to leave comments

Similar Stories


dlaravel

Description of .env.example file on D-Laravel

This article explains about the .env settings on D-Laravel MYSQL_ROOT_PASSWORD=secret LARAVEL_INSTALLER='container' DOCKER_SERVICES='docker-compose.yml service/redis.yml'

laravel

Let's run Laravel

If you haven't heard of D-Laravel, let me introduce it. D-Laravel is a Laravel and docker execution environment built with docker-compose. Let us quickly generate Laravel projects through simple bash. This article teaches you how to use the docker image provided by D-Laravel to build a swoole execution development environment. After reading this article, you should be able to quickly create a swoole execution environment through D-Laravel.

laravel,Laravel security

Lock IP in Laravel debug mode

Laravel's debugging mode is quite rich. Laravel's official website has a reminder that you can set APP_DEBUG to true for local development, but in the production environment, this value must always be False.