How-to - Category

One single (and easy) step to increase comments for WordPress users

Tweet this

One of the goals I stated in my 10 blogging goals for 2007 was to increase the number of comments this site receives. This has definitely been working – amazing how when you post something, the odds of receiving comments is much higher ;)

In my research into building comments, I stumbled across something that’s extremely useful, and extremely obvious: subscribe to comments.

Mark Jaquith recently released version 2.1 of his amazing subscribe to comments plugin for WordPress. This brilliant plugin allows your readers to be notified when a comment has been left on your post. By doing so, it encourages ongoing interaction between your site’s readers.

How many times have you left a brilliant comment, and forgotten to check back to see if there’s a reply? If you’re running WordPress, you can make that a thing of the past.

The beauty of the plugin is that all you need to do is install it – there are no changes to the templates required. I installed it on Almost Cool just yesterday, and I’ve already seen an increase in comments left.

How to set up a 301 redirect using htaccess

Tweet this

almost easy seoHow to set up a 301 redirect using htaccess you ask? Better yet, why would one do such a thing?

Both are questions I was asking myself late last week. A friend had mentioned that there were SEO implications to having both theblogstudio.com and http://www.theblogstudio.com floating on the net.

See, Google et al treat theblogstudio.com and www.theblogstudio.com as separate sites. Technically, www is a subdomain, similar to this.that.com, where that.com is the domain, and this is the subdomain.

In other words, www.theblogstudio.com and theblogstudio.com might be stealing page rank and search juice from each other. This will not do!

This is where the 301 redirect comes in. A redirect simply tells any browser that’s looking for theblogstudio.com to automatically go to www.theblogstudio.com. Setting up is pretty simple, if you’re comfortable editing files on a server.

Assuming you know your way around an ftp program (I use Transmit, for the mac), point your self at your hosting account. Look in the root or public_html folders (setup may be different, according to your host) and try to find a file called .htaccess Note the . before the name. This means that it’s a hidden file. You may have to look for “Show Hidden Files” in your ftp program. Try looking in Preferences or under the View menu.

Not all blog programs require .htaccess, and not all hosting plans allow it’s use. So you may be out of luck using this technique. Not to fear though! Webconfs.com lists 7 different ways to create a 301 redirect.

Assuming you’ve found the .htaccess file, make a copy of it somewhere for backup. Next, open the file in a text editor. The following is from webconfs.com/how-to-redirect-a-webpage.php (reposted here with permission).

Redirect to www (htaccess redirect)

Create a .htaccess file with the below code, it will ensure that all requests coming in to domain.com will get redirected to http://www.domain.com

The .htaccess file needs to be placed in the root directory of your old website (i.e the same directory where your index file is placed)

Options +FollowSymlinks

RewriteEngine on

rewritecond %{http_host} ^domain.com [nc]

rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]

Please REPLACE domain.com and http://www.newdomain.com with your actual domain name.

Note* This .htaccess method of redirection works ONLY on Linux servers having the Apache Mod-Rewrite moduled enabled.

You can stick this at the end of your existing .htaccess file. Now replace the version on the server with your modified file (you did make a backup of the original file, right?). Test it out.

You can use a 301 redirect for a variety of things, including moving domains (just point your old URL to the new site), directing search engines when you move a file, and more. Creating a 301 redirect is a gentle way to enter the dark world of .htaccess. With a little knowledge, and a good command of copy and paste, you can customize your .htaccess file to do some very useful things. For a great list of stupid htaccess tricks, check out Perishable Press

Business Blog Basics - Starts TODAY

Tweet this

File this under “It’s a good idea to look at your calendar”.



Andy Wibbels and I will be teaching another Business Blog Basics course starting at 3pm EST today.


The course is filled with info for those of you either new to blogging, or considering adding a blog to your marketing mix.



If you can’t make the first call, it’s ok – we record it, so you can listen to it at your convenience.



More details can be found at the course site.

More on using segment_x in Expression Engine

Tweet this

Yesterday Mike posted a tip about using segment_x in expression engine templates. This is a very powerful feature of EE, and is worth a bit more explanation.

First, you’ve got to know what the heck a segment is! Expression Engine uses a unique url structure. Every url in an EE site looks something like

mysite.com/index.php/sectionName/templateName/articleName

In this example segment_1 sectionName, segment_2 templateName and segement_3 articleName. Knowing this, we can get our templates to do some pretty flexible things, without a lot of heavy lifting on our part.

I’m going to assume that like us, you build your templates to be modular. For example, our index page for a given template group might look like like so:

{embed global/header}
{embed weblog/content}
{embed weblog/sidebar}
{embed global/footer}

Now, if you use that structure, you’ll need to change each template group’s index page to the correct weblog name. But using Mike’s trick, you could replace the word weblog with {segment_1} and use the same template for all your weblogs.

Admittedly, this is a pretty small time saver. Inspired by Mike’s post though, I saved myself a whole bunch of time this morning when I decided I wanted to use a different background image for a particular section on a site I’m building. Instead of making changes to the individual weblog’s template, I changed the body tag in the global header (we use a template group called “global” to store all the reusable bits and embed them as needed) to

<body id="{segment_1}">

Now all the weblogs can be easily targeted individually via my stylesheet. In my css I just added this new rule

// note that I'm using #weblog for this example. 
//In actuality, I used the name of the template 
//group I'm targeting
 

#weblog #wrapper{ background: url(path/to/images/newImage.jpg) repeat-y #fff; }

Here’s another way I used segment_1 on a recent project. I wanted to create an active state for my navigation. This is always a tricky thing to do. But with EE, it’s dead simple. Check it out:

note - ee keeps parsing the if statement so I've
removed the {} for this example

 

a href="/blah/" if segment_1 “home” id=”active”/if>home

What happens here is that each link is evaluated, and if the first segment of the url following the /index.php/ is found to match the criteria, then id=”active” is written in the html.

Now that I think about it, I can combine the body id=”{segment_1}” trick with the id=”active” trick and save myself even more time. Here’s how:

Because I’m assigning the body tag the id of the active weblog, I can clean up my nav and get rid of the if statements entirely. In my css, I can write

 

#nav #weblogName a:link {background: url(path/to/images/activestate.jpg)}

This will make my EE templates a bit cleaner, but will add to the file size of my css. Since the css is only loaded once per session, it will make a small performance upgrade, since EE won’t have to assess the if statement each time the page loads.

As you can see, using segment_x opens up a huge world of possibilities. Bottom line, however you use it, it can save you a bunch of time.

Introducing a new voice and a new series

Tweet this

Ladies and gentlemen, please allow me to introduce a new voice here to The Blog Studio blog (note, we need a better name for our blog – suggestions?): Michael Caputo, aka flashpunk, aka the guitarist for Birds of Wales.

Mike is a great designer in his own right, as you can see from both his personal site and his band site. Above and beyond that though, Mike’s quite the wiz with WordPress, Expression Engine, and Movable Type.

Mike will be stepping in as frequently as I can coerce him to share some of the tips and tricks he’s developed when working with code. Take it away Mike…