Category Archives: site

Rewriting urls with mod rewrite and .htaccess, and wordpress.

Every time I do anything on this blog I run into this problem.  UK2 (who host me) have one public_html folder for euphy.co.uk, and then subfolders for polargraph.co.uk and my other domains.  This is just the way the product is structured – the other domains are addons to the original.

But the problem with it is that I can easily choose where the other domains get their source from.  So I can easily change polargraph.co.uk to look in public_html/polargraph_newsite if I want to test something new out.  But it’s not as easy to redirect visitors to this site (euphy.co.uk), because the main domain can’t be treated that way, it seems.  I don’t pretend to understand why.

So I have this site running in a subdirectory (public_html/ev3), and use following mod_rewrite rules in the .htaccess file to rewrite the incoming urls:

Options +FollowSymlinks
RewriteEngine on
IndexIgnore *

RewriteCond %{HTTP_HOST} ^(www.)?euphy.co.uk$
RewriteCond %{REQUEST_URI} !^/ev3/
RewriteRule ^(.*)$ /ev3/$1
RewriteCond %{HTTP_HOST} ^(www.)?euphy.co.uk$
RewriteRule ^(/)?$ ev3/index.php [L]

In this case, because I installed wordpress into euphy.co.uk/ev3/, all of the urls in the site pointed there as the root, instead of to www.euphy.co.uk.  This exasperated me in the past, and every time I’ve done this, because I thought there was some rewriting magic going on.  But it’s dead simple, it’s just the root domain name settings in wordpress itself (admin->settings->general->wordpress address and site address).  DUH.

So this is the new personal site.

For a while I’ve been busy with drawing machines or jewellery, and each of those things have their own corners of the internet, but I’ve been neglecting the original one – www.euphy.co.uk.  

So this is the relaunch.  The old website worked ok, but it was coded from scratch in php by me in 2006, and was only ever just good enough – and fairly clumsy and awkward in many ways.  And I don’t really have the time or the inclination to continue work on that.

So this will be the personal site, that will hopefully function as a notepad for technical stuff that I want to keep track of and stuff that I think is hard to find on the web already.  As well as new project development stuff.  Polargraph has entirely dominated my time for the last two years, and I’m not having it any more!

It will also have the same self-indulgent rubbish on it as the old one did.  I might migrate the old stuff over, but probably only the useful bits.