2016-11-21 5 views
3

こんにちは皆私はLaravel 5.2のプロジェクトで作業しています。ローカルマシン上でプロジェクトをセットアップしましたが、URLにindex.phpを追加しなくても動作します。laravel 5.2プロジェクトはURLにindex.phpを追加せずに実行されていません

私は、URLを要求: -

http://localhost/project_folder/admin 

私はindex.phpをせずに実行し、私のURLを実行しようとしていますが、それは誤り以下の私を与えます。私は、以下のステップでした。このため

Not Found 

The requested URL /project_folder/admin was not found on this server. 

: 1)ストレージとキャッシュフォルダへのアクセス許可(777)を得ました。 2)私はパス/etc/apache2/sites-available/000-default.confに行き、それを編集します。

<VirtualHost *:80> 
    # The ServerName directive sets the request scheme, hostname and port that 
    # the server uses to identify itself. This is used when creating 
    # redirection URLs. In the context of virtual hosts, the ServerName 
    # specifies what hostname must appear in the request's Host: header to 
    # match this virtual host. For the default virtual host (this file) this 
    # value is not decisive as it is used as a last resort host regardless. 
    # However, you must set it for any further virtual host explicitly. 
    #ServerName www.example.com 

    ServerAdmin [email protected] 
    DocumentRoot /var/www/html 

    # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, 
    # error, crit, alert, emerg. 
    # It is also possible to configure the loglevel for particular 
    # modules, e.g. 
    #LogLevel info ssl:warn 

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

    # For most configuration files from conf-available/, which are 
    # enabled or disabled at a global level, it is possible to 
    # include a line for only one particular virtual host. For example the 
    # following line enables the CGI configuration for this host only 
    # after it has been globally disabled with "a2disconf". 
    #Include conf-available/serve-cgi-bin.conf 

<Directory /var/www/html> 
    Options Indexes FollowSymLinks MultiViews 
     AllowOverride All 
     Order allow,deny 
     allow from all 
</Directory> 
</VirtualHost> 

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet 

私の.htaccessファイルには次のコードがあります。

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

    RewriteEngine On 

    # Redirect Trailing Slashes If Not A Folder... 
    RewriteCond %{REQUEST_FILENAME} !-d 
    #RewriteRule ^(.*)/$ /$1 [L,R=301] 
    RewriteRule ^(.*)/$ /moduleTesting/$1 [L,R=301] 

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

    # Handle Authorization Header 
    RewriteCond %{HTTP:Authorization} . 
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 
</IfModule> 

要件やその他のものを忘れた場合は、私に提案してください。

+0

何の 'のDirectoryIndexにindex.phpはありません'あなたのapache設定で。 Apacheは、URLによって提供されるファイルがないときに開くべきデフォルトのファイルを知りません –

+0

[Apache 2.2のmod \ _rewriteを有効にする方法](http://stackoverflow.com/questions/869092)/how-to-enable-mod-rewrite-for-apache-2-2) – Matheno

+0

Apacheサービスを開始しましたか? –

答えて

4

モードの書き換えを有効にしてください。 お使いのシステム上で有効にするには、モッズ書き換えを持っていることを確認してください(コードを持つinfo.phpでのmod_rewriteを検索)ターミナルrunコマンドで

<?php 
phpinfo(); 
?> 

を:。

$ sudo a2enmod rewrite 
関連する問題