Category Archives: Languages

Increase PHP’s File Upload Settings with .htaccess

From time to time the need comes up to increase the maximum file upload size for a website. For reference, what I’m referring to is uploading media files (pictures, PDFs, data files, etc.) through an HTML web form.

Typically PHP comes configured to allow a 2 Meg upload size. Some web hosting companies allow you to make these changes directly in the PHP.ini file. In that case you open your PHP.ini file and simply look for “upload_max_filesize”, “post_max_size”, and “memory_limit” and make the appropriate changes.

If no PHP.ini file is available through your hosting platform an alternative method for adjusting this would be to add the following three lines to your .htaccess file.

php_value  upload_max_filesize  8M
php_value  post_max_size  16M
php_value  memory_limit  24M 

Some notes:

Keep in mind that extra large files will take longer to upload so you’ll want to make sure that your scripts do not time out when uploading. This will be a trial-and-error process based most likely on your client’s Internet connection speeds.

SEO Audit Outline


How to Perform the World’s Greatest SEO Audit by Steve Webb, Ph.D.

… Thanks, Steve, for the good reference.

This article was posted on SEOMoz recently and I thought that it would make a great resource to have on-hand for reference when reviewing a website for SEO quality. The article is written by Steve Webb (see article references on this page) and I have captured the outline here for my reference. Visit the article for all of the full details.

SEO Audit Preparation

  • Crawl Before You Walk
  • Crawling Tools
  • Crawling Configuration
  • Ask the Oracles

SEO Audit Analysis

  • Accessibility
    • Robots.txt
    • Robots Meta Tags
    • HTTP Status Codes
    • XML Sitemap
    • Site Architecture
    • Flash and JavaScript Navigation
    • Site Performance
  • Indexability
    • Site: Command
    • Index Sanity Checks
    • Page Searches
    • Brand Searches
    • Search Engine Penalties
    • Make Sure You’ve Actually Been Penalized
    • Identify the Reason(s) for the Penalty
    • Fix the Site’s Penalized Behavior
    • Request Reconsideration
  • On-Page Ranking Factors
    • URLs
    • URL-based Duplicate Content
    • Content
    • Information Architecture
    • Keyword Cannibalism
    • Duplicate Content
    • HTML Markup
    • Titles
    • Meta Descriptions
    • Other <head> Tags
    • Images
    • Outlinks
    • Other <body> Tags
  • Off-Page Ranking Factors
    • Popularity
    • Trustworthiness
    • Backlink Profile
    • Authority
    • Social Engagement
    • Competitive Analysis

SEO Audit Report

  • Write for multiple audiences
  • Prioritize, prioritize, and then prioritize some more
  • Provide actionable suggestions

URL Trailing Slashes and Canonical URLs

I noticed recently in my Google Webmaster Tools account that Google seems to be honing in on house cleaning for webmasters. Maybe it’s the recent Google updates that have come down the pike in the past twelve months and maybe it’s just my imagination but nonetheless it’s a good habit for webmasters to practice.

The one thing that lead my suspicion of this was the notes on a few of my sites that Google has begun to put into “HTML Improvements area is alerts over trailing slashes in the URL string. For reference, the following URLs are not the same to a search engine:


Because I generally don’t link to any index.html files directly inside of directories, the first two in the list were of particular concern to me and not the third.

The solution is to put the following three lines into your .htaccess file:

RewriteCond %{REQUEST_URI} !\.[^./]+$
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$$1/ [R=301,L]

That will automatically enter the trailing slash to the url if it is not already present. Remember to keep those three lines together in the .htaccess file.

Websafe Fonts and Other Options


  • Arial, Helvetica, sans-serif;
  • ‘Arial Black’, Gadget, sans-serif;
  • ‘Bookman Old Style’, serif;
  • ‘Comic Sans MS’, cursive;
  • Courier, monospace;
  • ‘Courier New’, Courier, monospace;
  • Garamond, serif;
  • Georgia, serif;
  • Impact, Charcoal, sans-serif;
  • ‘Lucida Console’, Monaco, monospace;
  • ‘Lucida Sans Unicode’, ‘Lucida Grande’, sans-serif;
  • ‘MS Sans Serif’, Geneva, sans-serif;
  • ‘MS Serif’, ‘New York’, sans-serif;
  • ‘Palatino Linotype’, ‘Book Antiqua’, Palatino, serif;
  • Symbol, sans-serif;
  • Tahoma, Geneva, sans-serif;
  • ‘Times New Roman’, Times, serif;
  • ‘Trebuchet MS’, Helvetica, sans-serif;
  • Verdana, Geneva, sans-serif;
  • Webdings, sans-serif;
  • Wingdings, ‘Zapf Dingbats’, sans-serif;


Websafe Fonts

If you don’t use an HTML editor that readily reminds you of all available websafe fonts it can be hard to remember those. Here is a list of several sites that have some good reference info on this.

Font Hosting Sites

Another thing to note is that if you need something a little more specific than the typical websafe font and don’t want to embed it all in a graphic, there are several font services — some free and some paid — that will serve the fonts to your website on demand.

Essentailly, all you do is put a link tag in the header of each page on which you use the font (<link href=”” />) and pull in the font as people visit your pages. Then you just call out the font in your CSS class (in your style sheet, within the <style></style> tags on your page, or inside of the style=”” attributes) like you normally would. Here are some places to find these. ( ( (

HTML Conditional Statements (IF IE)

IF conditions are allowed in HTML and can be a very powerful way to quickly eliminate cross-browser issues. The IF IE set of conditionals is great to have on hand and can save hours of frustration when trying to wrap up projects quickly.

Here they are:

<p class="accent">
<!--[if IE]>
According to the conditional comment this is IE<br />
<!--[if IE 6]>
According to the conditional comment this is IE 6<br />
<!--[if IE 7]>
According to the conditional comment this is IE 7<br />
<!--[if IE 8]>
According to the conditional comment this is IE 8<br />
<!--[if IE 9]>
According to the conditional comment this is IE 9<br />
<!--[if gte IE 8]>
According to the conditional comment this is IE 8 or higher<br />
<!--[if lt IE 9]>
According to the conditional comment this is IE lower than 9<br />
<!--[if lte IE 7]>
According to the conditional comment this is IE lower or equal to 7<br />
<!--[if gt IE 6]>
According to the conditional comment this is IE greater than 6<br />
<!--[if !IE]> -->
According to the conditional comment this is not IE<br />
<!-- <![endif]-->

Note that they are only allowed in HTML and not in CSS. IF you want to load a whole separate CSS file for IE for one reason or another you can put the link tag into the conditional as follows:


    <!--[if IE]>
      	<link rel='stylesheet' href='stylesheet.css' type='text/css' />

  <body> ... 




Printing HTML with Page Breaks

A common need for a web developer is to be able to design a web page that is intended to be printed by an end-user. Printing through the web browser’s “print” button or the JavaScript window.print feature is not too difficult, particular with the CSS properties: “page-break-before” and “page-break-after“.

div {
  page-break-before: always;


div {
  page-break-after: always;

Here are some references:


Here are the property options:

Value Description
auto Default. Insert a page break after the element if necessary
always Insert a page break after the element
avoid Avoid inserting a page break after the element
left Insert page breaks after the element until it reaches a blank left page
right Insert page breaks after the element until it reaches a blank right page
inherit Specifies that the value of the page-break-after property should be inherited from the parent element

(table content from

NOTE: Keep in mind that if you have the page-break-after: always; set on a page element, even if nothing follows it on that particular page, there will always be a second page printed each time you print. If you want to stop that second page from always printing, use the page-break-before: always; property instead. Use that property any place you want the new page to START.

Running PHP Script Inside of .HTM and .HTML Files

If your site is running on a LAMP (Linux, Apache, MySQL, PHP) platform it is possible to make the server execute PHP scripts inside of a .HTM or .HTML page.  Pages with the HTML file extensions (.htm or .html) typically, when requested from the server are just sent straight to the browser by the server. With those extensions the web server assumes that there is nothing more to do than that. With Apache’s .htaccess file, however, you can alter this.

Why would you want to do that? It is common for webmasters to come across situations where a site consists entirely of static HTML files and the job does not allow for changing those extensions. Typically this is for search engine reasons.

The quick work-around for this is to add a line or to into the .htaccess file in the site’s root directory that will tell the server to look through each .html or .htm files for PHP scripting prior to sending them to the requesting browser/user. The exact lines of .htaccess code will depending upon the settings of the server that you’re running on but here are the most common.

AddHandler php-script .htm .html


AddType application/x-httpd-php .php .htm .html

Each simply tells the server to parse HTML pages as if they were PHP pages and generally, one of those two lines will accomplish the goal.