所有路由导致404

时间:2017-08-16 14:25:36

标签: php apache laravel .htaccess

我们正试图在运行Apache的Ubuntu服务器上使用我们的Laravel项目。虽然所有路由和功能都在本地工作,但在上线后,所有不是归属路由的路由都会导致404错误。

我在/ public目录中使用默认的laravel .htaccess。

我的 { test: /\.html$/, loader: WebPackAngularTranslate.htmlLoader(), exclude: /src\/index\.html$/ } 如下所示:

/etc/apache2/sites-available

<VirtualHost *:80> ServerName mydomain.com ServerAlias www.mydomain.com ServerAdmin webmaster@localhost DocumentRoot /var/www/html/mydomain.com/public <Directory /var/www/mydomain.com/public> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny Allow from all </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> 根目录当前不包含任何.htaccess。

我使用/mydomain.com/启用了modrewrite,并在每次更改后重新启动了apache。

还有其他人遇到过这个问题吗?我很感激有关如何解决的任何建议。

提前致谢!

1 个答案:

答案 0 :(得分:2)

你在每一行都写mydomin.com。但是后来你谈到了mydomain.com文件夹。 (注意A)。这只是一种错误吗?

更新:问题是另一个错误输入:目录应该在以下几行相同:

    DocumentRoot /var/www/html/mydomain.com/public
    <Directory /var/www/html/mydomain.com/public>