【问题标题】:Laravel 5.1 "/" Route redirects to Default Apache Page. /index.php and all other route works fineLaravel 5.1 "/" 路由重定向到默认 Apache 页面。 /index.php 和所有其他路线都可以正常工作
【发布时间】:2016-04-08 16:16:46
【问题描述】:

我在 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>

配置文件 服务器名称 104.131.48.27 服务器别名 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

【问题讨论】:

  • index.php 显示什么?
  • @SamSolomon: 1XX.XX.XX.101/index.php 工作正常。

标签: php apache laravel-5 routes


【解决方案1】:

解决了。问题出在我的浏览器缓存上。重启机器解决了这个问题。

【讨论】:

    猜你喜欢
    • 2018-02-14
    • 2019-01-20
    • 2021-02-22
    • 2017-03-07
    • 1970-01-01
    • 2015-01-02
    • 1970-01-01
    • 1970-01-01
    • 2020-02-13
    相关资源
    最近更新 更多