Miva Merchant Quick and Dirty IP Blocking

Miva Merchant Modules and Development
Here is some Miva template code to quickly block bad IP addresses from using up your Miva Merchant site's bandwidth.

Miva Merchant Quick and Dirty IP Blocking

Your Miva store getting hammered by bots? If the Block IP module isn't working, try this.


Here is some Miva template code to quickly block bad IP addresses from using up your Miva Merchant site's bandwidth.

by Scot Ranney • October 31, 2024

Miva Merchant, Miva Merchant Storemorph, Website Tips & Tricks


Sometimes you need to quickly block some IP addresses and we have a Block IP module for Miva Merchant that does just this. The only problem is that we've gotten a few reports that it's not working and may be blocking everyone, regardless of IP.

If this happens to you here's a quick fix until we find out what's wrong with the module. This fix is not quite as elegant as the Block IP module because it will allow bots/spammers past the first wall of defense, but it will save your bandwidth until you can get your host to add the bad IPs to their block list.

In the Miva Merchant admin, go to USER INTERFACE > GLOBAL SETTINGS and find the HTML PROFILE template.

Put the following code at the top of the HTML PROFILE template:

<mvt:comment>
#
# Add IP addresses here, putting | symbols around each address to keep them separate.
# Tell your host about the bad IPs and once your host handles them you can remove this code.
#
</mvt:comment>

<mvt:if expr="s.remote_addr IN '|123.123.123.123|345.345.345.345|'">
	<html>
	<head>
		<title>Closed for maintenance</title>
	</head>
	<body>
		<h1>We're closed for maintenance, check back later.</h1>
	</body>
	</html>
	<mvt:exit />
</mvt:if>

Replace the IP addresses in the code above with the ones you want to block. You can add as many as you want but at your earliest convenience ask your host to add the bad IPs to their own list. Once they do that you can remove this code from your HTML PROFILE template.

Make sure you wrap each IP address with the bar | symbol to separate the IP addresses.

Related Posts and Information


overall rating:
my rating: log in to rate

bots spammers miva merchant stormorph

The blog posts on Scot's Scripts are made using by Scot's Blogger, a full featured Wordpress replacement Miva Merchant blogging module.