Redirecting a Directory with WordPress Redirection

The WordPress Redirection Plugin is a great tool for redirecting urls and is especially helpful if you move your website to a different directory or change a blog location on your site.  With that said, it is also a plugin with little documentation that can be hard for newcomers to navigate.

Recently we converted a client’s website from an old static html setup to be powered entirely by WordPress.  The old setup had a blog that was Worpress based and all the files for the blog resided in the /blog/ folder.  When we transferred the old blog to the new WordPress installation it left quite a few broken links in its path including links to images.  In order to fix this we had to create a redirect that would simply remove the /blog/ folder from the url parameter however it was tricky because we did not want to forward EVERYTHING with the /blog/ string in it.  Here is an example of what we wanted to rewrite:

We wanted this to be done to ALL files with just one single redirect. So to accomplish this we put the following into the WordPress Redirection Plugin:

Redirection Plugin

 

Be sure to check the “regex” box and replace “blog/wp-content/” and “wp-content” with your directory names.

By |January 20th, 2014|Snippets, Wordpress|2 Comments

2 Comments

  1. edi April 7, 2014 at 12:57 pm - Reply

    dear sir… is this for one cpanel only? how if i want to redirect to other url such as facebook album or other service. maybe you have any good idea? thanx

    • Chris Moore April 7, 2014 at 5:26 pm - Reply

      edi,
      This is for redirecting within a plugin within WordPress. This is NOT for Cpanel. You can redirect to any url with this plugin.

Leave A Comment