Everybody Staze...

Nobody leavz...

  • Home
  • About Me
    • LinkedIn
    • Lab
  • Contact
  • Links
  • Reviews
  • Sitemap
  • Weather
You are here: Home / Archives for mod_rewrite

Canonical URLs

2010/07/29 By staze

At work, we’re looking at a major webpage redesign, and are therefore looking at other similar programs and their websites to see what they are using… and one major thing has struck me in the process. No one uses redirects to force certain URLs. For example: http://www.staze.org vs http://staze.org. Now, in one case, both work, and they present the same content (bad for SEO), in the WORST case, one works, and the other doesn’t. Almost none of the sites we looked at handled this correctly.

Really, it’s extremely easy to fix. Either in .htaccess, or in your virtual host file, just add something like:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^localhost [OR]
RewriteCond %{HTTP_HOST} ^127\.0\.0\.1
RewriteRule ^(.*) – [L]
RewriteCond %{HTTP_HOST} !^www\.example\.com
RewriteRule ^/(.*) http://www.example.com/$1 [R=301,L]

UPDATE: Please see the corrected code above to account for anything referencing your site on the local machine via localhost, or 127.0.0.1…. some of my site broke without me noticing until today. DOH!

[Read more…]

Filed Under: Sys Admin Tagged With: Canonical, mod_rewrite, URL

Optimize Prime

2010/04/26 By staze

Using the wonder that is a personal website, I’m spending today working on optimizing page load times on my site. I’m already ran my theme images through smush.it, and am now working on hosting static files on a non-cookied domain.

This is a test image:

Better rewrite code: here dealing with better mod_rewrite code for a wordpress permalink site, is, amazing.

It significantly sped up this site, and I’m planning to implement it on a couple other sites tomorrow at work.

Also of note, I do a fair amount of post revisions, which added up to about 600 or so revisions in wordpress. That can really slow down a site. So, I ran a nice plugin (though the “copy” on the wordpress site is HORRIBLE) called Delete-Revision that really helped speed up things (in addition to the above).

Sweet!

Links of Interest:

  • http://storecrowd.com/blog/wordpress-optimisation/
  • http://www.askapache.com/htaccess/mod_rewrite-tips-and-tricks.html

Update: So, I got my site up to an “A” score (90 points) on YSlow. The main problems were that for some reason, js files weren’t being compressed, I didn’t have ETags configured, and I needed to get Expires Headers working. They are now working. When I started, my score was in the 70’s. As for Google PageSpeed, I’m at a 95/100. For the longest time, I couldn’t get cookies to not cross domains. Turns out, hidden in the google docks here, I had to set the setDomainName to “None” to disable cross subdomain tracking. Since I got that fixed, google is bitching about parallelizing downloads. So, I’ll have to work on that a bit more. Might set up a rewritemap to randomly rewrite requests to static content to various aliases of my static subdomain… we’ll have to see if this works. =/

Filed Under: Sys Admin Tagged With: mod_rewrite, optimize, smush.it, Wordpress

Weather

Categories / Archives

  • Apple
  • Coding
  • Electronics
  • Energy
  • Home Ownership
  • Miscellany
  • Politics
  • Prius
  • Sys Admin
  • Travel
  • Uncategorized
  • Work
  • June 2026
  • April 2026
  • August 2025
  • April 2025
  • January 2024
  • February 2021
  • July 2020
  • January 2020
  • April 2019
  • March 2018
  • February 2018
  • June 2017

Copyright © 2026 · Staze On Genesis Framework · WordPress · Log in