我已经安装了LAMP堆栈的Ubuntu 14.04服务器。
我有一个目录/home/alex/checkhtml
,其中包括一些测试php和html。
我想要的是当我访问http://localhost/checkhtml时,/home/alex/checkhtml
的内容将会显示(实际上/home/alex/checkhtml/index.html
)
这是我做的:
apache-php.conf
文件将这些行添加到apache-php.conf
:
Alias ^/php "/home/alex/php"
<Directory /home/alex/php>
Order allow,deny
Require all granted
</Directory>
转到/ home / alex / checkhtml并创建.htaccess
并添加以下行:
<FilesMatch ".">
Allow from all
</FilesMatch>
启用apache-php.conf
并重启apache
然而,当我尝试:http://localhost/checkhtml时。出现错误:
The requested URL /checkhtml was not found on this server.
有谁知道我在这里做错了什么?
谢谢你,并致以最诚挚的问候。
亚历
答案 0 :(得分:0)
您应该使用Alias driective进行精确的URL匹配。如果要使用正则表达式匹配,请使用AliasMatch指令:
AliasMatch "^/checkhtml" "/home/alex/checkhtml"
<Directory /home/alex/checkhtml>
Require all granted
</Directory>