Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: Location vs LocationMatch |
|
Author |
|
Btaz
Joined: 29 Oct 2012 Posts: 1
|
Posted: Mon 19 Nov '12 18:15 Post subject: Location vs LocationMatch |
|
|
I am trying to get a bit smarter about how I protect web transfers and recently discovered that my re-write rules were not case sensitive. So rather than use Location I found that LocationMatch could do the trick. BTW, I'm using Apache 2.4.3.
I've found the following to work where if any case version of mysecrectsslfolder is typed in I force the user to https.
Code: | #//entire folder
<LocationMatch "(?i)/mySecretSSLfolder">
RewriteEngine on
Options FollowSymLinks ExecCGI
RewriteCond %{HTTPS} off
RewriteRule /mySSLfolder(.*)$ https://%{HTTP_HOST}/mySecretSSLfolder$1 [R]
</LocationMatch> |
But now I'm trying to change a wordpress path to do the same, but cannot get the rules to work.
Here is the older version that is not case sensitive. Note that it only works for the specific page.
Code: | #//specific webpage
<Location /wordpress/wp-login.php>
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}/wordpress/wp-login.php [R]
</Location> |
Here is my new, non-working, non-case sensitve method. Note that I'm trying to catch anything with the wp-login.php in path.
Code: | # #//specific webpage
<LocationMatch "(?i)/wordpress/wp-login.php">
RewriteEngine on
Options FollowSymLinks
RewriteCond %{HTTPS} off
RewriteRule /wordpress/wp-login.php(.*)$ https://%{HTTP_HOST}/wordpress/wp-login.php$1 [R]
</LocationMatch> |
Any ideas why this isn't working or suggestions on how to debug what is going wrong?
Thanks. |
|
Back to top |
|
|
|
|
|
|