I need apache to call file.php when either of the following urls are called:
- /file.xml
- /file-contents.xml
- /file-abc.xml
- /file-n.xml
- /file-xyz.xml
Here’s a sample from my apache conf file: (the second to last line is the critical one)
<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>
I can get file.xml and file-contents.xml to call file.php just fine. But wildcards aren’t working.
What do you recommend?
ANSWER:
Thanks to Marc B!
AliasMatch ^/file-(.*).xml /html/file.php
AliasMatchallows regexes for this sort of thing: http://httpd.apache.org/docs/2.0/mod/mod_alias.html#aliasmatch