Here is what we have:

 Alias /assets/ "/home/virtual/public_assets/"
 AliasMatch ^/~([a-zA-Z0-9]+)/assets/(.*)$ /home/virtual/public_assets/$2

 <Directory "/home/virtual/public_assets">
      AllowOverride All

Here is the URI we are trying to match to:


The Alias directive works for our live sites, however, the AliasMatch which is supposed to match user directories does not.

  • 2
    if you have enabled the userdir directive, try to disable it – neo Jan 23 '13 at 11:34
  • Why not use a cleaner conditional rewrite using htaccess? – Simon Hayter Feb 12 '13 at 23:19

I have tested your configuration and it works fine on a clean Apache install. It is possible you have other conflicting configuration somewhere.

I would also test it with a single user in the AliasMatch directive rather than the generic pattern you currently have. Like this:

 AliasMatch ^/~admin30/assets/(.*)$ /home/virtual/public_assets/$1

Also if you could describe what does actually happens it might help. If you get an error, check the Apache error log and show us any relevant entries.

| improve this answer | |

I suspect that you need to put your AliasMatch directive before the alias directive. I think it works best to have the most specific paths first.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.