I need help getting apache's LocationMatch
to work.
I'm trying to set up a cobbler server, and it requires SSL by default. I want to rewrite so that people can use http://server/cobbler_web instead as well as the https://server/cobbler_web, and it will bring them to the same page. I am trying to use LocationMatch
to match cobbler_web
in the URL, like so:
### Force SSL only on the WebUI
<VirtualHost *:80>
<LocationMatch "^/cobbler_web/">
RewriteEngine on
RewriteRule ^(.*) https://%{SERVER_NAME}/%{REQUEST_URI} [R,L]
</LocationMatch>
</VirtualHost>
but no matter what I try on the LocationMatch line, nothing works. I've tried the line you see above, and also .*cobbler_web.*
, and ^/cobbler_web/.*
, amongst others. No joy.
If I remove the LocationMatch
entirely, it works.
Thanks.
If you're turning on the rewrite engine anyway, just use that to match the location:
Not sure why this configuration doesn't work, but in this simple case plain old
<Location "/cobbler_web/">
should be enough.