httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Krist van Besien" <krist.vanbes...@gmail.com>
Subject Re: [users@httpd] Regular expresions for dummies
Date Thu, 10 Jan 2008 15:20:02 GMT
On Jan 10, 2008 3:58 PM, Lester Caine <lester@lsces.co.uk> wrote:
> I'm trying to set up an AliasMatch to catch some now quite regular attempts to
> find 'phpmyadmin' using a whole string of different case versions of
> 'phpmyadmin' and then 'phpmyadmin-(various version number strings)'
>
> I think my starting point needs to be a nice dummy reference to writing the
> necessary regular expression. Alternatively can someone who has already done
> it provide me with an sample :)
>
> Of cause what is more annoying is that my web page footer lists the tools I'm
> using - and a link to the server set-up so if they looked they would know I
> don't use MySQL!
>
> Having started to get everything under control I'm spending a little time each
> day checking the error log and so anything to strip garbage and just leave the
> real errors will be useful. I have a couple of other similar AliasMatch
> entries to create but http://perldoc.perl.org/perlre.html is going over my head :(

http://perldoc.perl.org/perlretut.html would be a better place to start :-)

The question remains what you want to achieve. Currently all these
requests for phpmyadmin get a 404 returned I presume. With a
AliasMatch you can have these requests return something else, at the
expense of extra work for you and your server. Why would you want
that?

Anyway you could use something like:

AliasMatch (?i)^/phpmyadmin    /there-is-no-phpmyadmin-here-so-bugger-off.html

(?i) makes the match case insensitive.
^ anchors your regular expression to the start of the url.

The rest is what you want to match, where you don't need to match the
whole string, just enough so it's unique. /phpmyadmin will match
/PHPMyAdmin, /PHPMyAdmin-someversion etc...

Krist



-- 
krist.vanbesien@gmail.com
krist@vanbesien.org
Bremgarten b. Bern, Switzerland
--
A: It reverses the normal flow of conversation.
Q: What's wrong with top-posting?
A: Top-posting.
Q: What's the biggest scourge on plain text email discussions?

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message