亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

Regarding the routing problem of PHP's Laravel framework, please ask the expert for answers.
天蓬老師
天蓬老師 2017-06-30 09:52:44
0
5
1008

I have defined the following routes in routes/wen.php:

When I access public/index.php, I can enter the Index method in the Index controller normally. At this time, my domain name is: 127.0.0.1/Laravel/public. Because of the apache configuration, index.php is opened by default only in It is not displayed in the domain name,
but I defined the second route, which is user in the root directory. At this time, I accessed 127.0.0.1/Laravel/public/user again
and the following error occurred

When I added index.php to 127.0.0.1/Laravel/public/index.php/user, it was accessible normally. I don’t understand why.
Why when I watched the video tutorial, others accessed it directly. Yes, no need to add index.php

天蓬老師
天蓬老師

歡迎選擇我的課程,讓我們一起見(jiàn)證您的進(jìn)步~~

reply all(5)
學(xué)霸

There is a problem with apache's rewrite configuration. URL rewriting failed.

巴扎黑

I always locate the public directory directly in nginx or apache, which means that public/index.php will be automatically accessed

代言

Basically, it is definitely due to url rewriting. I also encountered it a few days ago. I followed the tutorial and wrote 127.0.0.1/Laravel/public/user and reported an error. I had an idea and just changed it to 127.0.0.1/Laravel/publicindex.php//user. . For this kind of thing, the poster doesn't have to fight hard, it's a waste of time, just know the principle. After learning, many problems will be solved easily!

為情所困

Add route redirect
Apache

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ / [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>

nginx

typecho

What the master above said is correct, but I wonder if your distributed configuration file in the public folder is gone. Can you check if there is an .htaccess file? Speaking of which, it is impossible to modify the public folder. You can skip index.php when accessing it, so I suggest you check if there is any problem with this file.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template