当调用以下任一URL时,我需要apache调用file.php:
/文件.xml
/文件内容.xml
/文件-abc.xml
/文件-n.xml
/文件-xyz.xml
下面是我的apache conf文件的一个示例:(倒数第二行是关键的一行)

<VirtualHost *:80>
    DocumentRoot /html
    ServerName domain.com

    UseCanonicalName Off

    Alias /file.xml /html/file.php
    Alias /file-contents.xml /html/file.php
    Alias /file-*.xml /html/file.php
</VirtualHost>

我可以让file.xml和file-contents.xml调用file.php。但通配符不起作用。
你推荐什么?
回答:
感谢马克B!
AliasMatch ^/file-(.*).xml /html/file.php

最佳答案

AliasMatch允许regex用于这类事情:http://httpd.apache.org/docs/2.0/mod/mod_alias.html#aliasmatch

关于http - 如何在apache config中使用通配符别名作为文件名?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/9707267/

10-11 23:27
查看更多