我的 .htaccess 文件包含垃圾值,例如
'dfdfsdfdsfdfdf'
另一个文件 httpd.conf(/etc/apache2/httpd.conf) 不包含任何内容
我希望至少 .htaccess 文件能够执行并将页面显示为
internal server error
我还更改了代码并更改了两个文件(.htaccess 和 httpd.conf),但页面 index.php 显示为好像没有两个文件(.htaccess 和 httpd.conf)。
原因是什么?
最佳答案
httpd.conf
应包含 AllowOverride All
用于文档根目录。
DocumentRoot "D:/Projects/Example/htdocs"
<Directory "D:/Projects/Example/htdocs">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
否则,使用
.htaccess
文件被禁用。
关于apache - .htaccess 不被 apache 读取,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13702639/