【问题标题】:Ubuntu Apache gives 404 error but index.php shows site cssUbuntu Apache 给出 404 错误但 index.php 显示站点 css
【发布时间】:2019-07-10 17:15:11
【问题描述】:

我在我的 ubuntu 18.04 localhost 上的一个子目录中设置了一个应用程序,所以 url 看起来像这样:localhost/app-name。 问题是我不断收到 apache 404 错误。我觉得我已经尝试了 default.conf 和 .htaccess 之间的所有内容。从好的方面来说,如果我键入 /index.php,它至少会给我一个来自站点本身的 404 页面错误,即站点 css。这是我的 default.conf 和 .htaccess 值得写在 litten 框架上

DocumentRoot /var/www/html/app-name/


<Directory /var/www/html>
AllowOverride All
</Directory>

<Directory /var/www/html/eduTrac-SIS/>
Options Indexes FollowSymLinks MultiViews
DirectoryIndex index.php
RewriteBase /app-name
AllowOverride All
Order allow,deny
allow from all
</Directory>

.htaccess

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /var/www/html/app-name/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

【问题讨论】:

  • htaccess.madewithlove.be 上尝试你的htaccess 也似乎你没有让文件去使用index.php。那应该是 RewriteRule ^(.*) index.php/$1 [NC,QSA,L]
  • 老实说,这对我没有多大帮助。记住这是在我的本地主机上
  • 是的,它是本地主机,但它调试数据。无论如何,框架使用 index.php 来服务所有页面对吗?

标签: php apache .htaccess ubuntu


【解决方案1】:

所以我想通了。我删除了 default.conf 中的所有额外内容,让 .htaccess 与框架内的其他一些更改一起完成。一切顺利。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-04-25
    • 2013-11-10
    • 1970-01-01
    • 1970-01-01
    • 2017-07-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多