by Devin Yang
(This article was automatically translated.)

Published - 6 years ago ( Updated - 6 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

After upgrading Laravel 8.8, I integrated the articles and notes together

Laravel 8 has undergone major revisions, and my website has also been revised accordingly. The "notes" and "articles" on my website were originally separated into two blocks. This time I integrated him together. Anyway, there are not many articles, and the combined content seems to be more. :p

laravel,oauth2

My most used Laravel passport directives

Laravel provides quite a lot of useful packages, such as Passport is one of them, when the website needs to set up its own OAuth2 authentication host, it really saves time and effort. Take this site as an example, because the front-end and back-end separation mechanisms are adopted (there are two different Laravel projects), and I verify them through the front-end WEB. Basically, I have many other different projects, and they all rely on OAuth2 provided by Laravel to handle cross-domain authentication.

dlaravel

How to directly execute the php artisan of different projects in the container on the host.

This article is the application teaching of D-Laravel, how to directly execute php artisan in the container on the host side. After customizing the alias, you can directly execute php artisan in the contianer in the project folder on the host side. alias a="../../artisan.sh"