Create Easy 301 Redirects Using the Yoast SEO Plugin



Yoast LogoSometimes, you may need an easy way to create a URL on your podcast site that automatically forwards to another location. For example, instead of simply asking your listeners to visit your iTunes listing by searching for your show inside of iTunes, you could simply tell them to go to example.com/itunes (example.com being replaced by your own URL, of course) instead. You can achieve this by setting up a 301 redirect on your website. The redirect will automatically tell a web browser to go from your specially crafted URL to wherever you’ve sent the redirect.

301’s are usually added to your website’s htaccess file, depending on what type of software your site is running. I use WordPress for all of my podcast sites, and all WordPress installations include their own htaccess files.

Htaccess files may be difficult to find with typical FTP clients. You may need to alter a client’s view settings or you may need to access your server’s control panel to get to the htaccess file. This may be annoying, but it’s actually a good thing as you can do some serious damage to your site if you were to accidentally delete or damage the htaccess file. But you can easily gain access to your site’s htaccess file by using the free Yoast WordPress SEO Plugin.

Once you’ve got the basic installation, activation and setup of the WordPress SEO Plugin complete, mouse over the “SEO” link in the left-hand sidebar of your WordPress dashboard. From there, click the “Edit Files” link toward the bottom of the menu that pops up:

SEO link in WordPress dashboard

This will take you to the Edit Files screen. Here, you’ll see the contents of your site’s current Robots.txt (if applicable) and htaccess files. WordPress has a built-in set of commands already embedded into the file. Those will start with “# BEGIN WordPress” and end with “# END WordPress.” LEAVE EVERYTHING BETWEEN THOSE BEGIN AND END TAGS ALONE. You’ll actually want to put your 301’s outside that block of WordPress code.

The following example shows how I’ve done an iTunes redirect. You can do the same thing by copying this exactly into your own htaccess file and clicking the Save changes button at the bottom of the page. (You’ll want to change my fake iTunes URL to the URL of your show’s iTunes listing.)

htaccess file editing inside Yoast SEO plugin

I put “# User added 301S” and “# End User Added 301S” around my iTunes 301 for reference purposes. These bits of code aren’t technically necessary, but they can be helpful if your htaccess file starts to get cluttered with a lot of different things. (Adding a # at the beginning of a line like this indicates that the text that follows is a comment and not actual code to be processed.) You’ll notice that the redirect 301 command starts with /itunes immediately followed by the iTunes Store URL. This is because the htaccess file is located in the site’s root directory, and the example.com part of your URL is implied. So, by putting /itunes into htaccess, we’re actually telling the file that the URL to redirect is example.com/itunes.

This particular example could be used to create a simple link from your website to anywhere, not just iTunes, And while I wouldn’t necessarily recommend making 301’s for every possible place your podcast lives outside of your own website, you certainly could. All you’d need to do is start a new line with redirect 301 and repeat the process, redirecting to each new URL as needed.

A WORD OF CAUTION! Breaking an htaccess file can seriously bork your entire website. Please be careful anytime you decide to make a change to htaccess. Remember, it’s always a good idea to make backups of a file like this before editing it, just in case.

Posted by Shawn Thorpe