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


laravel

Basic application teaching of jenkins CI Server pipeline on Laravel

Do you want to build a continuous integration and delivery CI Server for Laravel through docker? Execute laravel dusk and phpunit on CI Server to easily handle automated testing and related records. After reading this article, you may find out how simple CI/CD is. I mean basic use.

Laravel,artisan

About the operation of --env in Laravel's artisan

This article uses Laravel 9.40.1 for operation. I believe many people know the usage of --env, but I still provide some information for Laravel beginners. In the artisan command, we can use --env to specify different .env files, so that under different subdomains, I can use different environments or even different databases. You should have also noticed that this site uses a multilingual environment, do you write two sets? Of course not, basically I created multiple .env in the same Project.

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.