7

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

Massimiliano Marini
  • 499
  • 1
  • 6
  • 16

1 Answers1

10

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.

larsks
  • 277,717
  • 41
  • 399
  • 399
  • Yes with the Alias directive works good, but what I do not want to do is to add many Alias for each site. In my example I've used site1 but the name is always variable. This is why I need to do it in a dynamic way. May be AliasMatch do the job or not? – Massimiliano Marini Mar 29 '12 at 14:23
  • Okay, I understand what you're trying to do. Do *all* the sites point to `/var/www/central-cms`? Or is there a relation between the site name and filesystem path? Can you update your question with an example showing how you expect access to `/site2/cms` to behave vs. how `/site1/cms` behaves? – larsks Mar 29 '12 at 14:28
  • Exactly all the URL that end with `cms` example `/name_of_the_site/cms` point to `/var/www/central-cms`, no relation between site name and file system path. Ok I update my question with an example. – Massimiliano Marini Mar 29 '12 at 16:22