Laravel 5.1" /"路由重定向到默认Apache页面。 /index.php和所有其他路线工作正常

时间:2016-04-08 16:16:47

标签: php apache laravel-5 routes

我在DigitalOCean Droplet上托管的Ubuntu 14.04上使用LAMP堆栈。我的ip 1XX.XX.XX.101将我重定向到Default Apache2页面,而1XX.XX.XX.101 / index.php或1XX.XX.XX.101 / any-uri工作正常。 我的laravel版本是5.1。有什么帮助吗?

我试过目录索引。 这适用于1XX.XX.XX.101 // 双斜杠或任意数量的斜杠超过2进入索引 我的.htaccess

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

    RewriteEngine On
<IfModule dir_module>
    DirectoryIndex index.php index.pl index.cgi index.asp index.shtml index.htm$
               default.php default.pl default.cgi default.asp default.shtml def$
               default.htm home.php home.pl home.cgi home.asp home.shtml home.h$
</IfModule>
    # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /$1 [L,R=301]
    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

配置文件     ServerName 104.131.48.27     ServerAlias 104.131.48.27

DocumentRoot /var/www/project/public
<Directory /var/www/project/public>
    # Don't show directory index
   Options -Indexes +FollowSymLinks +MultiViews

    # Allow .htaccess files
    AllowOverride All

    # Allow web access to this directory
    Require all granted
</Directory>

# Error and access logs
ErrorLog ${APACHE_LOG_DIR}/raven.error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/my-site.access.log combined

0 个答案:

没有答案