I want to block access via rewrite to IBM WebSphere WCM:
/wps/wcm/webinterface/login/login.jsp
And allow access to everything else under
/wps/*
Any ideas? I tried:
RewriteCond %{REQUEST_URI} ^/wps/wcm/webinterface/login/login.jsp [OR,NC]
RewriteCond %{REQUEST_URI} !^/wps.*
RewriteRule ^/.* https://myhost.com/wps/portal [L,R=permanent]
2
Answers
I got it working using the following (here's a snip of my rewrites)
Thanks everyone!
Try the following instead (you don’t need to use mod_rewrite here):
This serves a 403 Forbidden for the specific URL as stated.
(Requires Apache 2.4)
Using mod_rewrite:
In a
.htaccess
context, the URL-path that theRewriteRule
pattern matches against does not start with a slash, so the pattern^/.*
will never match (so the request is never "blocked"). However, you need the slash prefix if the rule is being used directly in a server or virtualhost context.Since you only want to block a specific URL, you don’t need to check that it’s not something else (ie. does not start with
/wps
). But OR’ing these two conditions does not make sense (according to your criteria) as it would block the stated URL and every other URL that does not start with/wps
.This also issues a 301 redirect, it doesn’t specifically "block" the request.
To block just that one URL you would need something like the following: