Laravel 5 is configured with the route Band "/", Why Url::route (' xxx ') cannot generate this underline

Source: Internet
Author: User

I configure the routing

But on the page.

I want the link form is http://m.xxx.com/gushi/back with "/" ask you the big God is not what configuration?

Reply content:

I configure the routing

But on the page.

I want the link form is http://m.xxx.com/gushi/back with "/" ask you the big God is not what configuration?

This is not purely a framework or routing problem, in the URL/is a specific meaning, so you can not set the/as a delimiter.
And in fact, for the Web server/category/and/category is the same address, you are superfluous.
Moreover, the first thing in routing parsing is to split the request URL according to '/', so you will not get the desired result by artificially adding/in the URL. It is like a file name is not used/because it causes the system to confuse the path.

If you really want to implement the back forward slash, in Apache. htaccess

#RewriteCond %{REQUEST_FILENAME} !-d#RewriteRule ^(.*)/$ /$1 [L,R=301]

Comment out, and then route this write

Route::get('/hero/',['uses'=>'Mobile\HerosController@category','as'=>'m_heroCategory']);

You can get a route like http://www.test.com/hero/.

Reference link Http://stackoverflow.com/questions/22063520/laravel-slash-after-url-redirects-to-root-folder

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.