Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Http 如何在apache配置中为文件名使用通配符别名?_Http_Apache2_Apache_Httpd.conf - Fatal编程技术网

Http 如何在apache配置中为文件名使用通配符别名?

Http 如何在apache配置中为文件名使用通配符别名?,http,apache2,apache,httpd.conf,Http,Apache2,Apache,Httpd.conf,调用以下URL时,我需要apache调用file.php: /file.xml /file-contents.xml /file-abc.xml /file-n.xml /file-xyz.xml 下面是我的apacheconf文件中的一个示例:(倒数第二行是关键行) AliasMatch允许对这类事情使用正则表达式:AliasMatch允许对这类事情使用正则表达式: <VirtualHost *:80> DocumentRoot /html ServerName

调用以下URL时,我需要apache调用file.php:

  • /file.xml
  • /file-contents.xml
  • /file-abc.xml
  • /file-n.xml
  • /file-xyz.xml
下面是我的apacheconf文件中的一个示例:(倒数第二行是关键行)


AliasMatch
允许对这类事情使用正则表达式:

AliasMatch
允许对这类事情使用正则表达式:

<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>
AliasMatch ^/file-(.*).xml /html/file.php