AliasMatch and RegEx

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

Site (I have a lot of sites) is available on the the URL: http://web.localdomain.dev/site1/

.

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

:?

Maybe AliasMatch

a solution? Any help with RegExp?

Example

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

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

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

and etc.

If I add /cms

to url, this url points to/var/www/central-cms

+3


source to share


1 answer


If I'm missing something, it looks like a simple directive Alias

will work:

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

      

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

If you want to do this for multiple sites, you can use the directive AliasMatch

. You can look at the AliasMatch documentation for more information, including some good examples, but you end up with something like this:



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

      

This means that access to /site1/cms/foo

will go to /var/www/central-cms/foo

... and so will the request for /site2/cms/foo

.

The expression [^/]*

matches any number of characters other than /

, which is important here, so a string cms

appearing elsewhere in the URL is not a problem.

+6


source







All Articles