Only Index page working after migrating your WordPress site?

As you can see from the previous post, I am in the process of moving some WordPress installations to a new server. I’ve done this before however like with the update script, always need forget the exact steps needed to get the newly migrated site fully working.

Step 1.

First thing to do is double check the httpd.conf file and check that AllowOverride is set to All for the directory. If not, make the change and then save the file.

<Directory /var/www/mydomain.co.uk>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>

Step 2.

Go to the WordPress dashboard for the site, visit settings > permalinks. I’ve been told that just opening the page is enough to get the new configuration working, but I don’t think pressing save hurts.

Changing Domain Name With WordPress

Simple one this but I always have to look up the code so thought I’d write it somewhere I can find it at ease.

If you move a site to a new domain and are using WordPress your CMS, after restoring your database you will need to run the below script to change the references in the database to the new domain you are configuring the site for.


SET @newURL = 'http://hitchinsit.co.uk';
SET @oldURL = 'http://new.hitchinsit.co.uk';

SELECT @newUrl;
SELECT @oldUrl;

UPDATE wp_options SET option_value = replace(option_value, @oldUrl, @newUrl) WHERE option_name = ‘home’ OR option_name = ‘siteurl’;
UPDATE wp_posts SET guid = replace(guid, @oldUrl, @newUrl);
UPDATE wp_posts SET post_content = replace(post_content, @oldUrl, @newUrl);
UPDATE wp_postmeta SET meta_value = replace(meta_value,@oldUrl, @newUrl);

Open Source Contributions – 2016

This blog is going very slowly, I’ve not yet got into the habit or pattern of regular writing. That was the main reason for starting this thing, to improve my writing and hopefully in turn improve upon my thinking.

For this post I decided to list the Open Source projects I’ve contributed to this year. All of them are financial donations rather than code contributions however, something I hope to change in 2017. Part of the problem is finding an Open Source project that lights my fire and I’ve not come across many so far. I’m thinking of something around the .Net Core stack and explore .Net on the Linux ecosystem.

So, the list of projects is below. I genuinely can’t remember the donation amounts however no one alone would be over £20. I hope whatever I donate can be of some help to the teams. Keep a server on for a few more hours!

Heidi SQL – I use this daily and it’s perfect for my needs. I’m used to MS SQL Server tooling and this software to me lives up to that standard.

DataTables.Net – This is a fantastic client-side datagrid component. I’ve used this in several projects and really enjoyed it every time. I’ve sponsored this product now for a few years and hope to for years to come.

Wikipedia – I have probably visited Wikipedia at least once every day this year (and most likley last year, and the year before that…) and can’t begin to think of a world without it. I’m more than happy to keep the site running, ad-free, sponsorship-free, open to all.

There are other projects that I’ll add to the list when I remember what they were!

Tool repair – Circular Saw

A fiend came to me the other day with a dead circular saw and wondered if I could take a look. It is an old bit of kit but a good quality tool that would be expensive to replace. Fault was easy to replicate, plug it in and turn it on. Nothing. I thought initially it would be the brushes needing replacing after years of daily wear, but on inspection it was something a little more basic.

fault

Yes indeed. Someone had been in here before and I assume attempted to replace the cable. As the wire wasn’t securely fastened the slightest of tugs and the join would pull apart. In the end I replaced the flex and did a better, neater and safer job of installing it properly.

faultfix3

The only thing I have doubts over is the strain relief for the cable. I tried with some zip ties to secure it to the casing as much as possible, it’s all I could really do without the proper clamp that would have been there when new.

faultfix2

As you can see from the pictures it’s a beautiful neat repair that will give the saw many more years of use. By the way, while the guts of the motor were out I did check the brushes and there was plenty more wear left in them.

brushes

I love repairing stuff. It’s always given me a great sense of satisfaction to make something broken work again. Shame a lot of electronics these days don’t really allow for any user servicing. We have a culture where we don’t fix things we replace them. This 15 minute fix and the cost of 3 meters of cable and a plug is massively more cost efficient than getting a new £250 saw just because of a small fault.

Daily Hacks Vol. 1

During the summer, the air conditioning in my Saab decided to work on it’s own terms leaving me a little hot on my hour and a bit commute home. I got it re-gassed in-case it was low however the mechanic said they removed a fair amount of existing coolant, so it likely wasn’t that.

A little troubleshooting later and I’d narrowed the issue down to an electrical fault and then quickly found the culprit.

fusebox2

This relay switched two circuits, compressor and something else I can’t remember. As you can see, it’s a little mucky. Being enclosed with a metal lid carbon buildup covered pretty much the whole inside. I gave it a clean with some WD40 Contact Cleaner and tried it out. Although it was working, it wasn’t working well enough to run without tripping.

I found someone on eBay breaking a Saab 9000 and asked if I could take all the fuses, relays and other light switching units from the engine bay fuse box. From experience, the big orange headlight unit can go and is expensive to replace (if it can’t be repaired) so thought it wise to buy up the whole box and keep some spares on hand.

While I waited for the replacement relay to make it’s way to me I fashioned a temporary manual relay unit, or hard wire the AC on all the time. See below the fine craftsmanship.

fusebox3

The little fix worked extremely well and kept me cool until the proper replacement got delivered. One thing I did learn, was that when you switch off the engine the circuit is still on. Had to jump start one time I forgot to remove it after I parked up at work. I know the wire shown is rather thin (not sure on the AWG rating) but the switching side is at maximum an amp, which is fine for this application.

fusebox1

Not a particular clever hack, or fancy in any way but it simple and effective and got the job done. I like to think of Darwin’s quote “It is not the strongest of the species that survives, nor the most intelligent; it is the one most adaptable to change.“.

Mounting SSD’s Inside Server Trays

I have recently wanted to put some SSD’s into one of my XenServer boxes to give the whole thing a little boost. The boxes I’m using are some weird Dell pedigree, 1U with 4 x 3.5 inch SATA bays with varying RAM. They pack 8 AMD cores across two CPU’s. Probably too old for production environments (enterprise that is) today however for development/tinkering they are ideal. They also, collectively, don’t use as much power as my old PowerEdge 1950 on it’s own.

The bays have mounting holes in the bottom to allow for fixing 2.5 inch drives so I thought it would be an easy task to fit the new units. I was wrong. First issue was screws. I could find plenty of them on eBay but not the countersunk sort. I thought countersunk ones would tighten flush against the bottom. But no.

SSD-1.png

After going through different sets of screws I realised this plan wasn’t going to work. Next option? Easy I thought, get some conversion mounts. I ordered some and thought this was finally solved. One thing I hasn’t considered with this approach is that it seems these mounting brackets are an even width on both side mounting the drive in the middle. Fine for a PC but bugger all use in a disc tray (as the data & power ports on the disk need to be in the same place).

By this point, it had taken me about a week to not get this sorted. I just wanted the discs in so I could start having fun with XenServer. Now, what you will see below isn’t pretty, but it works. I had this foam-paper board stuff left over from another project and a good sharp utility knife. So, I cut out ‘blanks’ that fill the size of the tray the proceed to cut the area out where the SSD needs to sit. A little fancy blue masking tape in lieu of screws and you have exactly what is needed.

As I said above, this isn’t pretty and I wouldn’t do this for anything near production level stuff however I do like the hackyness of it.

SSD-5_S SSD-3_S SSD-2_S SSD-4_S

Software person with Hardware ambitions.