【发布时间】: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