Archive for the ‘HowTo’ Category

Wordpress auto updates

Saturday, August 22nd, 2009

Background

If you host, or have friends who host wordpress sites, then you know that upades are frequent, and its time consuming to upgrade each site.  I wanted to find a way to automate the process using a command line script, but before I thought about writing one, I thought someone else must have done this before.  Turns out they did.

Aaron Toponce wrote a wonderful script to do the upgrade, and as many of the comments on the site point out it has some serious flaws, but for anyone with some understanding of scripts, its a great start, thanks!

The main issues I found with it,  was the security issue, specificly that the backups are all stored in the public folder, and that was easy to remedy, however someone already did that too.

Jerry Bell updated the script and he also made some other enhancements, but not the one that I felt was most important.  The issue is, that it does not disable, and re-enable plug-ins.  Now, as far as I was able to determine, its not the most important thing to disable them, but it seems to me if wordpress claims it must be done, it should be done.

A little more research, and I was able to determine that the reason the scripts do not disable the plug-ins, is because you have to do it in the database.  Jeff Star pointed out how to disable & enable the plug-ins using the database.

Putting it all together

Using these resources I built a script that will:

  1. Download the latest version of wordpress
  2. Backup all the databases
  3. Backup the files and folders
  4. Disable the plug-ins
  5. Upgrade the wordpres directories
  6. Restore the files and folders
  7. Enable the plug-ins
  8. Clean up

Here is the final script.

SSL Certification

Tuesday, August 18th, 2009

This comes up from time to time, people need ssl certificates for websites, but they do not want to pay for the SSL certificate until development is completed, or they have not yet found the best URL choice for the website.

To help out, self assigned SSL certificates can really go a long way.  Most of the time there is a charge from the ISP for installing the self assigned SSL certificate, but it may really be worth it, so that development of the site can continue.

Here is a great link to a site that shows how to make many different self assigned certificates for a variety of operating systems, if you have access to do so on your server, they can be helpful.

http://www.sslshopper.com/article-how-to-create-a-self-signed-certificate.html

Of course self assigned does have some problems, specifcly the dreaded invalid SSL certificate window.

You can still continue to test the site, by accepting the certificate, and that is the best part of Self assigned SSL certs, they let you use the site as if it were a valid site.  You may also have other warnings that may come form internet security software, but generally speaking, they all have a way to continue to use the site.

301 Reasons to Redirect

Friday, June 12th, 2009

One thing about being a web site developer that can begin to drive anyone crazy, is the demands that people make, based on some other website/developer who is hyping some technology/hack that they believe will make their site better/appear higher in page ranking.

An old SEO technique, that used to work, but is now dead in my book, is 301 Redirects.  The basic use of a URL redirect, is to allow web site owners to change a URL, and forward the old URL to the new URL.  The reason is to prevent 404 Errors, and to allow web site owners to make website changes, and still have the users bookmarks function.

What happened, was people realized, if the had a page that had a high ranking in a search engine, they could sell that location, using a redirect to another site.  Then the user with the other site, would essentially have a high ranking in a search engine immediately.  This worked, but not anymore.

Search engines had to get smarter, and now they check if the link that are returning in a search has a 301, and if so, to where, and if that new page is not similar enough, it looses ranking.  Now you might say, similar enough?  I would say I am not an expert on the subject, but the idea of purchasing some domain to redirect to your own to boost up your ranking is not the best method.

Anyway, if your clients, or you, are interested in it, here is how to setup the redirect on the original server.  By the way, this also works for legitimate changes, like URL shortening, and domain moving, just in case your here for that.  Some people might ask, what if I have an HTML only page, how can I redirect then?  The answer is, you have to use the actual web server to do the redirect, I did not cover how to do that here.

(Languages are alphabetical.)

ASP

Below is the only content that you can have on the page, if you have automatic headers or footers, or anything like that, it will not work, this should be the entire page.


<% @ Language = vbscript %>
<%
   Response.Status='301 Moved Permanently'
   Response.AddHeader='Location','http://www.yourdomain.com/yourpage'
%>

ASP .NET

Below is the only content that you can have on the page, if you have automatic headers or footers, or anything like that, it will not work, this should be the entire page.

<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
   Response.Status = "301 Moved Permanently";
   Response.AddHeader("Location","http://www.yourdomain.com/yourpage");
}
</script>

ColdFusion

Below is the only content that you can have on the page, if you have automatic headers or footers, or anything like that, it will not work, this should be the entire page.


<cfheader statuscode="301" statustext="Moved permanently">
<cfheader name="Location" value="http://www.yourdomain.com/yourpage">

JSP (Java) Redirect


<%
  response.setStatus(301);
  response.setHeader( "Location", "http://www.yourdomain.com/yourpage" );
  response.setHeader( "Connection", "close" );
%>

PHP

Below is the only content that you can have on the page, if you have automatic headers or footers, or anything like that, it will not work, this should be the entire page.


<?php
  header('HTTP/1.1 301 Moved Permanently');
  header('Location:http://www.yourdomain.com/yourpage');
?>

Ruby on Rails

def old_action
headers["Status"] = "301 Moved Permanently"
redirect_to "http://www.yourdomain.com/yourpage"
end

Safari Masquerading as iPhone

Thursday, June 11th, 2009

As promised, here is a re-post of how to get Safari to masquerade as an iPhone, so that you can test your websites user agent sniffing.

  1. Open Safari’s Preferences dialog.
  2. Enable the development menu in safari Preferences.  First select Advanced, then make sure the  “Show Develop menu in menu bar” is checked.
  3. Close the Preferences Dialog
  4. Now go to the Develop menu in safar to select the iPhone as the user agent
  5. Optionally, you may want to shrink the window down, so that you can get a better feel for the size of the web that your browsing.

That’s all there is to it, enjoy.

Enable a Mobile View of Wordpress

Wednesday, June 10th, 2009

Now that we moved to Wordpress, the first plug in I have added is called WPTouch.  The idea is to auto-format the site for mobile devices, and for me, the most imporant mobile device is the iPhone.

Brave New Code was started in 2007, and their main focus is a website design/development firm, but the seem to have a few goodiesunder GPL for folks like us, kudos to them.

The instructions on the site, are excellent, and installation is a snap.  The basic method is download the plug in, and place it in your plug-ins folder.  Now go to your Wordpress admin control panel, and activate the plug-in.  Installation is done, no kidding.

To try it out, you can use an iPhone and visit this blog, maybe your already doing that.  In a previous post I talked about setting Safari to pretend to be a iPhone, but since the old blog is gone, I may re-post it.  The next thing to do is configure it using the admin control panel that WPtouch installs for you, again the instructions on how to do this are excellent.

I hope you enjoy this is a simple way to ensure a great experience for your Wordpress users.


SEO Powered by Platinum SEO from Techblissonline