【问题标题】:Why is my website showing the directory index of my site not the actual site?为什么我的网站显示我网站的目录索引而不是实际网站?
【发布时间】:2014-05-19 21:49:21
【问题描述】:

我在这里扯头发,但我的网站在我的实时网站上显示的是我的网站内容列表,而不是网站本身。 .htaccess 是我在所有 laravel 构建中一直使用的。

.htaccess:

# The htaccess file
RewriteEngine On

RewriteCond %{HTTP_HOST} ^{yoursite}.{extension} [NC]
RewriteRule (.*) http://www.{yoursite}.{extension}/$1 [R=301,L]

RewriteCond %{REQUEST_URI} !public/
RewriteRule (.*) /public/$1 [L]

当我访问站点根目录时,由于某种原因,我只是得到一个文件列表,它没有读取 /public/ 文件夹中的 index.php 文件。

谁能建议解决这个问题?

【问题讨论】:

  • 尝试将 DirectoryIndex index.php 添加到您的 htaccess 文件中
  • hmm 尝试将其添加到文件末尾,但它不起作用
  • 尝试运行命令php composer install。
  • 我想澄清一下,你需要安装作曲家才能做到这一点。
  • 最好创建一个virtual host。

标签: php .htaccess laravel dns


【解决方案1】:

听起来好像没有为该目录启用 PHP。确保您的虚拟主机配置正确,并且 PHP 已启用 mod_rewrite。

【讨论】:

    猜你喜欢
    • 2014-06-28
    • 1970-01-01
    • 1970-01-01
    • 2013-03-05
    • 1970-01-01
    • 1970-01-01
    • 2023-03-26
    • 1970-01-01
    相关资源
    最近更新 更多