When I load pages that are not root, the page won't load without index.php before the route. The error I get:

 Not Found

 The requested URL /login was not found on this server.

 Apache/2.4.7 (Ubuntu) Server at mydomain.com Port 80

To start with I have a virtual host file containing:

//also tried adding DirectoryIndex here before <directory>
<directory /var/www/mydomain.com>
    DirectoryIndex index.php
    AllowOverride ALL
</directory>

还有一个.在我的公众中访问:

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

    RewriteEngine On

    # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /$1 [L,R=301]

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

I have another domain with the same .htaccess and appache config on the same server and it works fine. Also I did restart apache. If I use phpinfo on my index.php/route page I see at Loaded Modules:

mod_rewrite mod_setenvif 

When running the website localy with xampp everything works fine. For hours i'm trying now but I can't fix it or find any error (logs are empty) or any solutions that I haven't tried yet.

Edit:

Im using Ubuntu Ubuntu 14.04 x64 on a digital ocean VPS. And I tried turning it on and off again (as suggested). PHP Version 5.5.9-1ubuntu4.9. I followed this tutorial to config everything (except the direcoty part). I changed the location of the apache log and a file error.log is created on the given directory but no errors are in it.

我当前的Appache配置是:this(我已经三次判断了域名所在的白色部分).

当我运行apache2ctl-t D DUMP_VHOSTS时

在此处输入图像描述

这在我看来很好,我也试过禁用默认配置,但没有帮助.

Note: i've replaced my real domain with mydomain.com in reality I use my real domain on these spots.

Thought how do I know for sure that the conf file im editing is the one being used by the domain?

推荐答案

I ended up deleting the complete conf file and copied it again from the one thats working. I took the default .htaccess from laravel and it worked. Unfortunately I still dont know what was wrong though. The current conf file looks like

<Directory /var/www/mydomain.com>
    AllowOverride ALL
    DirectoryIndex index.php
</Directory>

我的HTC公共访问

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

    RewriteEngine On

    # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /$1 [L,R=301]

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

Laravel相关问答推荐

如何解决此 Backblaze B2 S3 兼容 API 错误?

按回车键时如何防止此功能运行?

使用两个日期之间的范围获取两列之间的记录,同时搜索过滤条件

如何在 laravel 中为另一个用户 session()->forget('cart')?

如何访问 Validator::extend 中的其他输入属性?

Laravel 5.1 如何在Blade 文件上使用 {{ old('') }} 助手进行无线电输入

使用 vue-router 更改路由时中止所有 Axios 请求

SQLSTATE [01000]:警告:1265 列的数据被截断(truncated)

Array_unique 上一个 laravel Eloquent的集合

中间件中的 Laravel 依赖注入

如何在 Laravel 5 中验证当前、新密码和新密码确认?

Http请求多浏览器的烦恼

Laravel 和 PHPStorm 项目的 gitignore 中包含什么?

如何处理 php (Laravel api) 和 javascript (AngularJS) 之间的日期时间

Laravel 迁移 - 删除列

升级到 laravel 5.3 后错误 datetime format: 1292 Incorrect datetime value: '0000-00-00 00:00:00'

Laravel 错误声明 App\Exceptions\Handler::report(Throwable $exception)

如何在 Laravel 或 Redis 中取消排队的作业(job)

Laravel 5 默认注册后如何发送邮件?

Laravel Eager加载与显式连接