deekayen.net

Content about deekayen.net

Alternative to blank AdSense ads

When you have a new page on your site, AdSense sometimes takes a few minutes to decide what ads to display on your site. Other times, there just isn't ad advertisement to fit your content. In both cases, Google displays a public service ad. Since AdSense gives you the option to display alternative content, why not take advantage of it to show an ad from a company that will show an ad, even when it doesn't match your content?


New randomizer module

In part just to see how quick I could write it, I copied a lot of the http://randomizer.org/ functionality to a new Drupal module called randomizer. It performs server-side random number generation, so it's not javascript dependent, like randomizer.org.

I didn't implement some of the features because I have other things I need to move on to, but the list people can sponsor me to finish is: markers, alternate random number generators (e.g., PHP's rand() vs mt_rand()), seeding, MS Excel export, randomize form input, or anything else you might want in your own version.


Contact form spam

I blocked 202.58.80.0/20, 65.94.252.160, 24.64.178.253, 216.196.194.162 and 203.162.0.0/16 from deekayen.net for trying to spam me with my own contact form. The emails never made it to my mailbox thanks to the server's spam filter, but I saw the attempts in my logs. They were over a span of eight minutes, so someone either has a nice drone network setup for spamming or a sophisticated network of servers. I didn't bother to see if they were in dialup pools or not. I don't much care about traffic from Malaysia or Vietnam, so those are the two blocks I denied. When I upgrade to Drupal 4.7, I'm adding captcha support for the contact module.


Bot filtering in Apache

Some people filter robots, spiders, and web crawlers to only allow a few with robots.txt. I prefer to filter email collectors I know have a bad reputation. Since not every bot bothers to even check for robots.txt, I use the Limit restriction to ban certain bots from deekayen.net using their user agent string. The smart bot creators allow users to change the user agent string, so this method isn't foolproof, but it lets me sleep better at night.


Uniform website URLs using mod_rewrite

While some people might type in "www.deekayen.net", others, like myself, don't type "www." anymore. Besides, telling someone your website address, starting with "www." is clumsy. Some people even leave off a W to say "ww.example.com". Worse yet, I've seen people actually listen and only type two w's. I use an Apache mod_rewrite rule to send a permanent redirect to users who type the "www.".

RewriteCond %{HTTP_HOST} !^deekayen.net [NC]RewriteRule ^/?(.*) http://deekayen.net/$1 [R=permanent,L]

The first translates to "if the URL you are requesting doesn't start with deekayen.net," followed by the second line triggered by the first, "then you must load http://deekayen.net/ instead. $1 will include the filename you requested. This is a permanent thing, so get used to it, because otherwise I'll keep redirecting you."

This rule can also be handy if you have multiple domain aliases for the same website. For example, I don't tell anyone about deekayen.com, but www.deekayen.com and deekayen.com both redirect under this rule to deekayen.net.


Syndicate content