Ever wondered how Google makes some of their pages have the extension .g? This is a fairly easy procedure really, and htaccess does a great deal in helping us accomplish this. First decide what you want the new extension to be, for our purposes we will use the extension of .purple (simply because it makes sense – what with the site being called Rapid Purple and all). Now we want all files with the .purple extension to be treated as PHP files, so we will add the following line to our .htaccess file:

AddHandler application/x-httpd-php .purple

This little command will tell your server to treat each file with the extension of .purple as if it were a PHP file. There are tons of handlers you can use for your custom extension, and listing them all is well beyond the scope of this tutorial, however here are just a few common ones:

  • Shockwave Flash: 
    application/x-shockwave-flash
  • XHTML: 
    application/xhtml+xml
  • ZIP: 
    application/zip
  • HTML: 
    text/html
  • CSS: 
    text/css
  • Java Script : 
    application/x-javascript

Published by Michael Boguslavskiy

Michael Boguslavskiy is a full-stack developer & online presence consultant based out of New York City. He's been offering freelance marketing & development services for over a decade. He currently manages Rapid Purple - and online webmaster resources center; and Media Explode - a full service marketing agency.

Leave a comment

Your email address will not be published. Required fields are marked *