2

DocumentRootexample.comにあり/var/www/htmlます。

Laravelがインストールされて/var/www/example/publicおり、アクセスできますが、asなどhttp://example.com/dashboardの他のルートにアクセスしようとするとエラーが発生します。と言って、誰か私を案内してくれませんか?http://example.com/dashboard/login404 Not FoundThe requested URL /var/www/example/public/index.php was not found on this server.

public ディレクトリの.htaccessファイルはそのままです。

は次の000-default.confとおりです。

ServerName example.com
UseCanonicalName Off
<Directory /var/www/html/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>
<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /dashboard /var/www/example/public
    <Directory /var/www/example/public>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>
</VirtualHost>
#dynamic subdomain provisioning
<VirtualHost *:80>
    DocumentRoot /var/www/example/public
    ServerName user.example.com
    ServerAlias *.example.com
    <Directory /var/www/example/public>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>
</VirtualHost>
4

1 に答える 1

0

000-default.confファイルで次を使用して解決できました。

<Directory /var/www/example/public>
    DirectoryIndex index.php
    AcceptPathInfo on
    AllowOverride All
    Options None
    Order allow,deny
    Allow from all
</Directory>

次の方法で laravel .htaccess を変更する必要がありました。

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

    RewriteEngine On
    RewriteBase /dashboard

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

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>
于 2015-02-23T13:22:40.460 に答える