Litwicki Media
  • Hire UsFREE Estimate!
  • Our WorkPortfolio of Work
  • ServicesWhat We Do
  • NotebookCompany Blog
  • DashboardMy Projects
  • Latest

    • Dashboard WYSIWYG
    • Switch to SMARTY from phpBB TEMPLATE Class
    • Litwicki Dashboard – Flexibility is Essential!
    • Working Title: Litwicki-Dashboard
    • Best Practices – Defining tables & writing SQL
  • Categories

    • Best Practices (2)
    • CSS (1)
    • Default (8)
    • HTML/XHTML (3)
    • Linux (1)
    • PHP (5)
    • Products (3)
    • Servers (1)
    • SQL (1)
    • Standards (2)
    • SVN (1)
    • Thoughts (2)
  • History

    • May 2010 (1)
    • April 2010 (3)
    • March 2010 (7)

.htaccess mod_rewrite for production server

This will allow you to ‘hide’ file extensions and make your site URL(s) much more friendly for search engines.

For example, instead of:

http://www.mydomain.com/products.php?name=dvdplayer

you can present

http://www.mydomain.com/products/dvdplayer

Additionally, you can customize error pages specific to the error itself to give your users/customers a more customized feel if they experience an error. And with some additional code, you can even generate some complex logging to track how/when that user encountered that error.


#Redirect errors to more specific pages
ErrorDocument 404 /404error.php
ErrorDocument 500 /500error.php


#SEO query strings
RewriteEngine on
RewriteRule ^about/?$ /about.php [L]
RewriteRule ^products/?$ /products.php [L]
RewriteRule ^products/([a-z]+)/?$ /products.php?name=$1 [L]
RewriteCond %{HTTP_HOST} !^www.mydomain.com$
RewriteRule ^(.*)$ http://www.mydomain.com/$1 [R=301]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ http://www.mydomain.com/ [R=301,L]

Continue reading » · Written on: 03-22-10 · No Comments »

Leave a Reply

Copyright © 2009 Litwicki Media LLC. Powered by Wordpress with the Litwicki Media theme.

Litwicki Media is a small website design & development studio. We make stunning websites with higher standards by raising the bar, without raising the cost. We have built websites for companies like Wal-Mart Realty, JD Power & Associates, Nestle USA, Acquisola, and dozens more!

  • HIRE US - FREE Estimate
  • Our Work
  • Services
  • Contact
  • About