Re: Regular expresions for dummies

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Jan 10, 2008 3:58 PM, Lester Caine <lester@xxxxxxxxxxx> 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@xxxxxxxxx
krist@xxxxxxxxxxxxx
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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux