尽管存在404错误,但仍未找到Laravel路由

时间:2019-05-13 21:58:19

标签: php laravel apache .htaccess vhosts

我正在使用在本地主机上使用Laravel的网站。 “ /”页面运行良好。我要访问的所有其他页面均导致404错误:找不到页面。这不是路由的定义,它们的定义都很好,而php artisan route:list命令可以很好地显示它们。

我正在使用Apache服务器。我已经通过网络找到解决方案。我已经尝试了许多建议,但仍然没有结果。

我尝试了here。这是我的.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>

在提出的解决方案中,我也做了RewriteBase /path/of/project/folder/,在我的情况下应该实际为RewriteBase /C:/xampp/htdocs/EOT.Crossroads/。这些都不起作用。取而代之的是,我得到了禁止访问错误..错误403,此精确更改。除了在Windows上,我还尝试了建议的here,并使用此控制台命令httpd -k restart重新启动了httpd服务。结果,我得到了[mpm_winnt:error] [pid 9068:tid 548] (OS 2)Le fichier spÚcifiÚ est introuvable. : AH00436: No installed service named "Apache2.4",此问题没有任何改变。然后,我对this进行了必要的修改;我的httpd-vhosts.conf文件:

<VirtualHost *:80>
    ##ServerAdmin webmaster@dummy-host2.example.com
    DocumentRoot "C:/xampp/htdocs"
    ##ServerName dummy-host2.example.com
    ##ErrorLog "logs/dummy-host2.example.com-error.log"
    ##CustomLog "logs/dummy-host2.example.com-access.log" common
    <Directory "C:/xampp/htdocs">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks Includes ExecCGI

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   AllowOverride FileInfo AuthConfig Limit
    #
    AllowOverride All

    #
    # Controls who can get stuff from this server.
    #
    Require all granted
    </Directory>
</VirtualHost>

以及apache httpd.conf文件..关于AllowOverride的所有部分

ServerName localhost:80

#
# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other 
# <Directory> blocks below.
#
<Directory />
    AllowOverride All
    Require all denied
</Directory>
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "C:/xampp/htdocs"
<Directory "C:/xampp/htdocs">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks Includes ExecCGI

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   AllowOverride FileInfo AuthConfig Limit
    #
    AllowOverride All

    #
    # Controls who can get stuff from this server.
    #
    Require all granted
</Directory>
#
# "C:/xampp/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "C:/xampp/cgi-bin">
    AllowOverride All
    Options None
    Require all granted
</Directory>

这些都不适合我。有什么想法吗?

0 个答案:

没有答案