Apple ‘upgrades’
Hmm, reading up on the big Apple hardware announcement on Tuesday I have to say I’m disappointed. I was really hoping for an OS X powered netbook. Instead what we have now is a so-called pro laptop with a shiny screen. Oh and if you want a small form factor laptop with firewire then you’re SOL because the MacBook only has USB2 in the new models.
Reading the various comments on TUAW the fanboy response of “if you want firewire buy a pro” is quite spectacularly idiotic. If your laptop is your only computer then fine, go pro. I however, already have a desktop, I don’t need another all singing all dancing workhorse, and 15 inch laptops are not very mobile. The MacBook is too expensive to be missing such a key port. I don’t mind that my Eee PC only does USB, it cost less than £300, it’s not designed to be used solo. A MacBook is, or was.
I’m seriously questioning my commitment to using Apple computers. I’ve already given up waiting for a netbook for this round of my laptop upgrade cycle with the purchase of the Eee. Currently I work on a white 20 inch iMac, what do I do if that breaks? Suck it up and buy a shiny screened iMac? Nope, I remember the nightmare of shiny CRTs too clearly. What about a Mac Pro? I design websites, I don’t operate mission control, 8 cores is overkill for my needs. And an £1800 starting price? Forget it. So it looks like either I join the dark side and get used to Windows or I switch to Linux. I’ve been using Ubuntu on my Eee and I’m impressed with it. It even runs Photoshop. Then there’s always VirtualBox to run anything that isn’t covered on linux.
How to setup SEO friendly URLs for WordPress on Zeus
UPDATE: Namesco now have a help page for dealing with rewrite.scripts with more up to date info than is contained in this blog post.
Up until a year ago I’d only ever used Apache to host websites. At Oxeye Daisy we host on Zeus webservers. After a lot of fruitless searching on the internet for guides on how to setup SEO friendly permalinks for WordPress hosted on Zeus I stumbled upon the relevant code. I’ve finally got around to tweaking and commenting it. I thought I’d post it here in case anyone else is having the same trouble.
First you need to go to your WordPress admin page and set up the permalink structure in Options > Permalinks. I’ve set mine to /%year%/%monthnum%/%day%/%postname%/ but you may want something different.
The notes in the script assume the requested URL to be http://www.domain.co.uk/blog/2007/10/31/an-example-post/?color=red I’ve added the GET queries so you can see how they are handled, they’re not used in WordPress. This URL is then translated into http://www.domain.co.uk/blog/index.php/2007/10/31/an-example-post/?color=red. Notice the index.php in the middle? That’s the key bit to making all this work.
Save the following code in a file called rewrite.script and upload it to your web space. Note that you will need to uncomment some parts of the script depending on whether your blog is in a sub directory or the top level of your site.
The code is currently set to work with a sub directory of blog. It has only been tested on Namesco servers and it’s set to ignore their specific hosting folders like webmail, controlpanel and tech_support.
RULE_0_START:
# Get the document root path and put value into the SCRATCH array.
# This is the server path not the web URL.
# e.g. /content/DesignerPlus/i/n/domain.co.uk/web/
map path into SCRATCH:DOCROOT from /
# Get the URL without the domain.
# e.g. /test&colour=red
# e.g. /blog/2007/10/31/an-example-post/?color=red
set SCRATCH:ORIG_URL = %{URL}
set SCRATCH:REQUEST_URI = %{URL}
# See if there are any queries in our URL.
match URL into $ with ^(.*)\?(.*)$
# If there are...
if matched then
# Set a var to path without the domain part.
# e.g. /blog/2007/10/31/an-example-post
set SCRATCH:REQUEST_URI = $1
# Set a var to the passed queries.
# e.g. colour=red
set SCRATCH:QUERY_STRING = $2
endif
RULE_0_END:
RULE_1_START:
# This is setting a var to the server path and sub folders.
# e.g. /content/DesignerPlus/i/n/domain.co.uk/web//blog/2007/10/31/an-example-post
set SCRATCH:REQUEST_FILENAME = %{SCRATCH:DOCROOT}
set SCRATCH:REQUEST_FILENAME . %{SCRATCH:REQUEST_URI}
# Check to see if the file exists.
look for file at %{SCRATCH:REQUEST_FILENAME}
if not exists then
# The file wasn't found so is it a folder?
look for dir at %{SCRATCH:REQUEST_FILENAME}
if not exists then
# No folder either. So now check the URL for special hosting folders.
match SCRATCH:ORIG_URL into % with ^/webmail|^/tech_support|^/controlpanel
if matched then
# If a special folder was requested end the script.
goto END
else
# There were no files, folders or special folders so set the new URL.
# -- Sub directory -------------------------------------------------------------
# If the blog is in a sub directory...
# e.g. /blog/index.php/2007/10/31/an-example-post
match SCRATCH:REQUEST_URI into $ with ^/blog(.*)
if matched then
set URL = /blog/index.php$1
# -- Top level -----------------------------------------------------------------
# If the blog is in the top level of the site...
# e.g. /index.php/2007/10/31/an-example-post
else
set URL = /index.php%{SCRATCH:REQUEST_URI}
# If there is only a top level blog you can remove the
# match and surrounding if statements.
endif
# -- ---------------------------------------------------------------------------
# Go to the next rule.
goto RULE_2_START
endif
endif
endif
# If files or folders were found end the rewrite script.
goto END
RULE_1_END:
RULE_2_START:
# Check for queries in the requested URL.
match SCRATCH:ORIG_URL into % with \?(.*)$
if matched then
# If queries were found add them to the new URL.
# e.g. /index.php/2007/10/31/an-example-post/&colour=red
set URL = %{URL}&%{SCRATCH:QUERY_STRING}
endif
# -- Sub directory -------------------------------------------------------------
# If you only want to rewrite the sub directory uncomment this bit.
match SCRATCH:ORIG_URL into % with ^/blog
if matched then
# -- Sub directory ends --------------------------------------------------------
# End the script.
goto END
# -- Sub directory -------------------------------------------------------------
endif
# -- Sub directory ends --------------------------------------------------------
RULE_2_END: