安装程序:Apache 2.2(Windows,win32)。
httpd.conf片段:
Alias /custom /var/www/custom DirectoryIndex index.html <Location /custom> SetHandler custom_handler DirectoryIndex index.html </Location> <Directory /var/www> Allow From all Options +Indexes AllowOverride all DirectoryIndex index.html </Directory>
也:
问题:
以上是如何处理的? 以下是要求:
重写某些url,例如
RewriteRule ^ custom / $ / custom / index.html [L,R]
上面的重写规则不pipe用,放在哪里(位于内部或外部)
您正在混合将URI映射到文件系统的一部分的几种不同的方式,而且它们并不一起工作。
首先,如果你的DocumentRoot是/var/www ,那么AliasMap是完全不必要的。 虽然这不是你的代码片段。
其次,由于/var/www/custom是一个目录,因此在引用它时应该使用Directory伪指令。 Location被用于不是目录的东西,但是你想要像以前一样行事。
要清除这些点,请尝试更改您的configuration,如下所示:
Alias /custom /var/www/custom # ONLY if you don't have /var/www as DocumentRoot! DirectoryIndex index.html <Directory /var/www> Allow From all Options +Indexes AllowOverride all </Directory> <Directory /var/www/custom> SetHandler custom_handler </Directory>