为什么我的 laravel 路由不能与 apache 服务器一起工作

问题描述 投票:0回答:1

我用 apache2 部署了一个 laravel 项目,目前正在尝试用 apache 访问我的路由,但它似乎不起作用。我检查了 mod_rewrite 并且它已启用,在目录 AllowOverride 中是全部但它不起作用。我将我的 .htaccess 文件留在下面:

  <IfModule mod_rewrite.c>
    Options -MultiViews
    Options +FollowSymLinks
    RewriteEngine On
     
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ /index.php [L]
  </IfModule>

我还添加了

> <VirtualHost *:80>
   ServerName domain.com
   ServerAdmin [email protected]
   DocumentRoot "c:/Users/erena/ErenA/public"
  Alias /testproject "c:/Users/erena/ErenA/public"
    <Directory c:/Users/erena/ErenA/public>
        Options -Indexes +FollowSymLinks +MultiViews
        AllowOverride All
    Require all granted
    </Directory>
   ErrorLog ${APACHE_LOG_DIR}/error.log
   CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

虚拟主机文件。

这是 conf 文件中的目录部分:

<Directory "c:/Users/erena/ErenA/public">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
DirectoryIndex index.php

有人能帮帮我吗?

laravel apache2
1个回答
0
投票

你的域名注册到/etc/hosts了吗?如果没有,请先注册并检查。

© www.soinside.com 2019 - 2024. All rights reserved.