Extract Domain Name From Hostname in PHP

When fighting spammers or other unwanted traffic it’s useful to be able to block a top level domain, such as ukhost4u.com or uk2.net. This needs to be extracted from the full hostname, which might be something like 123-456-789-10.ukhost4u.com. To do that you’ll need a combination of a PHP built-in function and a regular expression.

Continue reading ‘Extract Domain Name From Hostname in PHP’ »

Convert DOCX to DOC Online for Free

Microsoft Word .docx Problem

As of Word 2007, Microsoft Office introduced a new file format (and extension) for Word, Excel, and PowerPoint documents. Prior to this, Word documents had the .doc extension, but new documents end in .docx. This can be a problem if you have a version of Microsoft Word prior to 2007, as there is no support for the new .docx format, and if someone send you a file in this format, you can’t open it!

Continue reading ‘Convert DOCX to DOC Online for Free’ »

Stop Apache mod_rewrite Appending Query String To Redirects

The Apache web server’s mod_rewrite module is a powerful tool for rewriting URLs. It can catch you off guard in certain situations. For example, if you’re matching a URL to rewrite or redirect to another, you may find that any query string is unexpectedly passed along, too.

Continue reading ‘Stop Apache mod_rewrite Appending Query String To Redirects’ »