php - 为什么我网站的所有子路径都找不到 404?
问题描述
最近我配置了我的服务器(LAMP)并上传了我的网站。主页运行良好,但所有其余页面都返回404 not found
。我猜这个问题与.htaccess
文件有关。这是.htaccess
根目录中存在的文件:
RewriteEngine on
Options -Indexes
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# this doesn't work on some version of xampp
# RewriteRule ^(.*)$ index.php?rt=$1 [L,QSA]
RewriteRule ^([\s\S]*)$ index.php?rt=$1 [L,B,QSA]
ErrorDocument 404 /error404.html
Options -Indexes
<Files *.php>
Order Deny,Allow
Deny from all
Allow from ::1
</Files>
<Files index.php>
Order Allow,Deny
Allow from all
</Files>
注意服务器操作系统是ubuntu 16.04。知道如何解决这个问题吗?
解决方案
<Files *.php>
Order Deny,Allow
Deny from all
Allow from ::1
</Files>
阻止除 index.php (这是您的主页)之外的所有 .php 文件。
推荐阅读
- django - Django ORM 按相关名称查询
- android - Recycler View 不更新来自 Firebase 数据库的消息:Android Studio
- reactjs - @react-navigation/native 和 @react-navigation/stack 读取整个堆栈
- javascript - 如何在角度模板中访问对象属性名称?
- reactjs - 如何在 React 中对元素的子项进行字体保护
- c - 是否可以在C中使用for循环来确定用户输入的值中哪个值最小而不使用数组?
- python - 将 cookie 导入 Selenium 不起作用
- node.js - 快递应用程序未向 MongoDB 发送 POST 请求
- cortex-m - 关于Cortex-M3向量表放置的问题
- node.js - 如何从 jwks-rsa 的 getSigningKey 函数中获取公钥