legend2v2---3、The requested URL /index1 was not found on this server

legend2v2---3、The requested URL /index1 was not found on this server

一、总结

一句话总结:

一般现象:首页能进,其它页不能访问
问题原因:【apache】服务器设置的问题
解决方式:项目的【public】目录的【.htaccess】中增加内容

二、The requested URL /index1 was not found on this server

Laravel Framework 8.20.1

1、问题

一般现象:首页能进,其它页不能访问

2、解答

问题原因:apache服务器设置的问题

解决方式:项目的public目录的.htaccess中增加如下内容

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

    RewriteEngine On

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

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

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

</IfModule>

#跨域设置
#<IfModule mod_headers.c>
#   Header add Access-Control-Allow-Origin: *
#</IfModule>
 
原文地址:https://www.cnblogs.com/Renyi-Fan/p/14192208.html