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,letsencrypt,haproxy

PHPENV's HAProxy environment is set up with free SSL certificate application

PHPENV has added the support of haproxy.yml. If you have an external IP and domain name, it should be quite simple to get HAProxy and certificate application through deviny/phpenv. In this article, let us see how to use HAProxy in the HAProxy environment setting in PHPENV.

laravel

Random passwords in Laravel maintenance mode

The functions mentioned in this article can only be used for Laravel 8 and later versions. If we have some test websites outside Laravel with external IPs, but we only want to access them for ourselves. Here's how I did it for reference

dlaravel

D-laravel has added the recommended opcache.ini settings

The latest version of D-Laravel has added opcache's recommended settings. The enabling method is very simple, please execute it in the D-Laravel directory.