MODX and .htaccess files
Everytime I launch a new site in MODX I inevitably return to the last site I build and copy the .htaccess file from, adjusting as neccessary. Instead, I am just going to post it here for my sake and yours.
What is below is pretty close to the ht.access included in the MODX Revo distribution, I've tweaked it to add compression (your Apache installation must have mod-gzip enabled) and removed the BrowserMatch lines, which ended up breaking some of my sites. (It might have been my Apache, but given that it targets IE 4, I think I'm safe leaving it out).
# Default to index.html, if its available. In case you need to take down
# the site temporarily and need to serve a static page.
DirectoryIndex index.html index.php
RewriteEngine On
RewriteBase /
# Send all requests to www.YOUR-DOMAIN.com
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\.YOUR-DOMAIN\.com [NC]
# Replace with your server's IP address (for user directories)
RewriteCond %{HTTP_HOST} !^123\.123\.123\.123 [NC]
RewriteRule (.*) http://www.YOUR-DOMAIN.com/$1 [R=301,L]
# The Friendly URLs part
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
# Make sure .htc files are served with the proper MIME type, which is critical
# for XP SP2. Un-comment if your host allows htaccess MIME type overrides.
AddType text/x-component .htc
# For servers that support output compression, you should pick up a bit of
# speed by un-commenting the following lines.
php_flag zlib.output_compression On
php_value zlib.output_compression_level 5
# More Compression
# compress text, html, javascript, css, xml:
#http://betterexplained.com/articles/how-to-optimize-your-site-with-gzip-compression/
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
# The following directives stop screen flicker in IE on CSS rollovers. If
# needed, un-comment the following rules. When they're in place, you may have
# to do a force-refresh in order to see changes in your designs.
ExpiresActive On
ExpiresByType image/gif A31622400
ExpiresByType image/jpeg A31622400
ExpiresByType image/png A31622400
ExpiresByType text/css A31622400
ExpiresByType application/javascript A31622400
ExpiresByType application/vnd.ms-fontobject A31622400
ExpiresByType text/plain A31622400
ExpiresByType image/x-icon A31622400
Published Apr 21 2012
Pseudo Cell Service In Hong Kong -- Cheap
I recently took a trip to Hong Kong was looking for a way to at least be able to text and email on the go. Problem: my US Virgin Mobile phone doesn't support SIM cards so I couldn't just buy one on the street and run, but I came up with another solution.
PCCW has pretty much blanketed Hong Kong with WiFi hotspots, over 9,000 of them including phone booths every other block or so, the MTR, and some buses. For $48HKD ($6USD) per month you can get unlimited access to those hotspots. Combined with Google Voice and HK Hotspot Connect (which automatically connects and logs you into WiFi hotspots) I had 'net access everywhere I went.
Bonus: with Skype I could even make calls.
Double bonus: I found keeping my phone in airplane mode with WiFi on took far less battery than having 3G on with WiFi off does at home.
Published Mar 28 2012
2012
Tech blog entries from 2012.
Published Mar 28 2012
Windows 8 Preview
Microsoft is finally embracing openess, at least in the course of development if not in a Gnu sense. I downloaded Windows 8 Developer Preview a couple of weeks ago to run in a virtual machine. After much frustration I finally installed it on the bare metal.
Wow.
It is prettier, faster and all around better than Windows 7. My personal opinion is that Windows 7 passed up Apple's OS X after ten years of stagnation. Barely, maybe tied, close at any rate. Windows 8 will put immense pressure on Apple to perform with OS X 10.8, because it will be better than OS 10.7.
I'll probably blog more on this in the future but a few highlights:
- Win8 is faster on the same hardware
- Win8 uses less memory (RAM) to run
- Win8 looks nice (so did Win7, but Win8 really does, finally playing Apple's game)
- It boots much, much faster.
- The interface is simplified in a good way
Published Oct 19 2011
How to Run Every Version of Internet Explorer
If you work on the technical side of web design (e.g., HTML/CSS/JS) you need to cross-test most of your work on Internet Explorer, often versions 6, 7, 8 and 9. This is problematic in that you can only have one of those versions installed on your computer at once.
Enter Virtual PC and Microsoft's Internet Explorer Application Compatiabiltiy VPC Image(s). As of this writing, MS has made available for free download, entire images of XP/IE6, Vista/IE7, Win7/IE8, Win7/IE9. So this means you can "boot" up Windows XP and Internet Explorer 6 inside your current Windows installation.
For Windows 7 Pro, download and install Virtual PC here, for Windows 7 Home Premium download and install Virtual PC 2007 here. The latter is not officially supported, but I haven't had any problems.
Published Jul 27 2011
2011
All Tech Blog entries in 2011.
Published Jul 23 2011
WinXP Support Ending
But not too soon.
As of today, there are 999 days left of support for Windows XP from Microsoft. For most of my clients this isn't an issue - I don't know anyone that can't run their older (at this point, much older) applications under Windows XP Mode in Windows 7.
The truth is, if you are still dependent on Windows XP you need to change, probably for a number of reasons. If your software vendor hasn't put out a new release it is probably time to find a new piece of software that is still innovating. WinXP has been security-ridden since it was released*. If you are just resisting upgrading, realize that by the time support officially ends you will have been putting it off for ten years.
Surely your software maker deserves some continuing income.
Plus, those of us who don't want all of our software designed for operating systems 10+ old will thank you :-)
*It did get better with Service Pack 2, but Windows 7 still beats the pants off of XP in my opinion.
Published Jul 12 2011