AliasMatch and RegEx

15,747

Unless I'm missing something, it looks like a simple Alias directive would work:

Alias /site1/cms /var/www/central-cms

If this doesn't work, you may need to provide us with more details regarding your configuration.

If you want to accomplish this for multiple sites, you can use the AliasMatch directive. You can look at the AliasMatch documentation for more information, including some good examples, but in the end you'll end up with something like this:

AliasMatch ^/[^/]*/cms(.*) /var/www/central-cms$1

This means that an access to /site1/cms/foo will go to /var/www/central-cms/foo...and so will a request for /site2/cms/foo.

The expression [^/]* matches any number of characters other than /, which is important here so that the string cms appearing elsewhere in the URL doesn't cause problems.

Share:
15,747
Massimiliano Marini
Author by

Massimiliano Marini

Me = { web : ['developer', 'designer']}

Updated on June 11, 2022

Comments

  • Massimiliano Marini
    Massimiliano Marini almost 2 years

    I'm working with a centralized CMS on a dev server, the CMS is in /var/www/central-cms

    The site (I've many sites) is accessible by this url: http://web.localdomain.dev/site1/.

    How can I access the cms simply typing this url: http://web.localdomain.dev/site1/cms?

    Maybe AliasMatch is the solution? Any help with the RegExp?

    Example

    http://web.localdomain.dev/stackoverlow/

    http://web.localdomain.dev/google/

    http://web.localdomain.dev/yahoo/

    etc.

    If I append a /cms to the url, this URL point to /var/www/central-cms