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


d-laravel,docker

D-Laravel v1.2.1 version change description (recommended update, must avoid stepping on thunder)

D-Laravel v1.2.1 revision instructions use GuzzleHttp\Client; When posting, there is an access denied problem. If you are upgrading from an older version, you may need to adjust the configuration file in etc/default-ssl.conf (if there is one) Please adjust php:9000 to web:9000, you can adjust it by executing ./console secure once. In the docker-compose configuration file, change the PHP-FPM container to network_mode: "service:web"...

web-hosting,laravel

Zhibang installs Laravel 5.4 experience sharing

Install Laravel 5.4 on Zhibang's Linux 7.0 platform, and successfully execute the case sharing, Because it was originally an old version of PHP, it can be transferred to the new version for free for the first time, So please ask them to open a test php 7.0 environment for us to test, after small adjustments, Laravel's environment can indeed be executed on Accton's managed host. This article introduces how I successfully implemented Laravel's website process in Zhibang.

laravel,sftp

Use Laravel's Storage SFTP Drvier for remote file upload

Why do I separate the front and back of the website? My idea is very simple, that is to rely on a set of background to control all the website data in the foreground. Assuming that the front-end website is a pure marketing website, it is nothing more than the subject content, just like the article above, without any particularly complicated logic. Therefore, it is enough to set up the backend database and connect different frontends. Then there is the last question, how can my backend HTML editor post pictures directly to the frontend? Laravel's Storage SFT Driver is a good antidote.