Redirect Editor plugin for WordPress

WordPress logoI was looking for a WordPress plugin to manage a list of post redirects, but what I found was a little over-engineered for my tastes. I just wanted a simple web-interface to something resembling an .htaccess file. So I built it. It’s called Redirect Editor, and it provides a single textbox to manage a list of redirects, one per line, consisting of a relative URL path to match and an absolute URL destination to redirect to, separated by a space, e.g.

/2012/09/old-post/ http://www.example.com/2012/09/new-post/

Blank lines and lines that start with # (hash) are ignored and can be used for spacing and comments.

Redirect Editor screenshot

Screenshot of the Redirect Editor interface

Instructions

  1. Download Redirect Editor v1.3 from the WordPress.org Plugin Directory (or from me here)
  2. Unzip the file and upload the folder redirect-editor to your wp-content/plugins/ directory
  3. Activate the plugin
  4. Go to Settings > Redirect Editor to configure

Questions, comments, and suggestions are always welcome. If you’re interested in contributing to the code behind Redirect Editor, it’s hosted on GitHub.

Feel free to if you found this useful.

23 Comments

paco

Hi
love this plugin, easy and effective
many thanks for it
a question :
is it possible to write and redirect directories, like /files/, instead of rewrite all one by one ?? ( like/files/file1.asp … /files/file2.asp …etc)

something like wildcards… /files/* etc…
many thanks for info
best regards
Happy Christmas

paco
madrid.spa.EU

Hey paco, I’m glad you like the plugin. Sure it’s possible, but it would take some work to implement. Also I wanted to keep it as simple as possible, so it wouldn’t trip people up. But I suppose I could add some level of pattern matching or wildcard character support. Not sure when I’ll get around to it though.

I’m having the weirdest thing happen, in that only some of the redirects listed work, and they’re all in the same format. I have no other redirect plugin working, deactivated Bulletproof Security, etc. Any ideas?

Nigel, shoot me an email with the list of redirects.

Hi Justin, just a quick question, and probably a silly one – but does this plugin setup the redirects as 301 permanent moves?

Kevin, yep, the redirects are all set up as 301 permanent moves.

DJF

Hey, great, easy to use plugin. I’m having trouble however getting them all working. Seems like when there are more than one directories involved its not working for me. For example, redirecting “/other/” works fine, but redirecting “/other/more-fun-stuff/” doesn’t seem to work. Any possible work arounds for this issue? Thanks!

DJF

Please disregard my comment. I was either caching or there was some server delay for those pages. Seems to be working now. Again, love the simplicity of this add-on, thanks again.

Eeli Kaikkonen

Nice, but doesn’t work with /#!/something/. The path /#!/ is generated by a theme, and after changing the theme we should redirect. Maybe the plugin takes this as comment because it has # ?

Eeli, the thing to realize is that any part of the URL after a # (hash) is known as a “fragment identifier” (even if it looks like a standard URL path) and thus it is not sent to the webserver by the web browser, and thus it is not visible to the Redirect Editor plugin for redirecting.

For example, the URL http://example.com/#!/my-blog-post/ would appear to the webserver simply as http://example.com/ and it would be up to some JavaScript on the web browser’s end to correctly request and display the right post.

If you switched from a theme that previously published “hash-bang URLs” to a theme that does not, you actually need to include some JavaScript in your new theme to perform the redirect—and it’ll be up to the browser to handle the fragment identifier. I’m not sure if such code exists, or what it would take to write.

Hope this helps somewhat.

J,

The plugin is working some of the time…I think the issue is related to using www or not…

I switched from Joomla on the root to WordPress running MultiSite on /live/…

http://11trees.com/blog.html works.
http://www.11trees.com/blog.html just goes to the home page.

Here is the line from redirect editor:
/blog.html http://11trees.com/live/category/11trees-blog/

Any thoughts? Thank you for the great plugin. Any help appreciated.

H, it doesn’t have anything to do with the plugin, it has to do with how “www” requests to your site are being redirected.

For example, I created a totally made up www URL to test:

http://www.11trees.com/foobar/

and it redirects to:

http://11trees.com/live/

…regardless of the “foobar” part.

So your “www” redirect (perhaps in an .htaccess file, or somehow set up by your webhost) is bypassing the Redirect Editor altogether. I hope this helps track down the issue. Email me if you want to discuss it in greater detail.

Maureen

Hi. I just installed Redirect Editor. I can’t seem to make it work for .asp pages. Example /blog.asp redirect to newwordpressssite.com/blog

Any help is very much appreciated.

borisa

Hi,
My name is Borisa Djuraskovic. I am associated with Web Hosting Hub community team.
I found your Redirect Editor plugin at http://justinsomnia.org/2012/09/redirect-editor-plugin-for-wordpress/ very interesting. I would like to translate it to my native Serbo-Croatian language and help people from my community find your plugin useful too. But you would need to create the translatable .pot file first in order for me to proceed. Please let me know if you are willing to do that so I can translate it.

Regards,
Borisa Djuraskovic

My redirect editor isn’t working. I notice they are all in one line, and your directions say they should each be on their own line. I can’t figure out how to insert a line break. I also notice the correct address is not hyperlinked, and it appears by your directions that they should be.

Rob, sorry for the delay in responding. I just checked out the plugin and discovered that a CSS error was causing the redirect lines to all appear on one line. Oops. It’s fixed in v1.3. Send me an email if you have any other questions.

James

Hi, this plugin is breaking my sites since the last update. Some users (but not all) are getting a redirect loop in Chrome/Safari. As soon as I deactivate the plugin, the problem is solved.

James, the only thing that changed in the latest update was a CSS-tweak for the admin textbox. My guess is that you’ve inadvertently created an infinite loop with the redirects you’ve chosen. Feel free to email me the content of your redirects and I’ll see if I can diagnose.

Dear Justin,
I am a beginner’s level user in India. Thank you very much for the plugin. I am really obliged with the efforts you have made. Until today I was not knowing my website has created any problems. I have redirected around 8 to 10 redirects from old URLs to new ones. I have checked them and working fine. My issue starts now. Today when I started to submit each URL to Fetch as Googlebot, it discovered the 301 redirects of my new website’s page. May be by mistake or earlier I have any webpage of that name. I am not sure. Can you please help me how to to fix for that URL to stop 301 redirect any further?
That URL is http://hd100.in/kampun-hd100-joint-filler/
Your early reply will be appreciated.

Darshan.

James

I love this plugin and use it on several sites. Just wondering if it’s still supported? I haven’t seen an update in a long time.

Jeremy Pyne

It still works. Also this patch will make it support Regex rewrites as well.

— redirect-editor.php
+++ (clipboard)
@@ -115,6 +115,16 @@
wp_redirect( $redirects[$request_url], 301 );
exit;
}
+
+ foreach($redirects as $match => $redirect) {
+ if(strpbrk($match, ‘*$^{}[]’)) {
+ $match = str_replace(‘/’, ‘\/’, $match);
+ if(preg_match(“/$match/”, $request_url)) {
+ wp_redirect ( preg_replace(“/$match/”, $redirect, $request_url), 301 );
+ exit;
+ }
+ }
+ }
}
}
}

Oleg

How do I redirect from the filters page?

Mond

Hello and thanks for this plugin that is very easy to use.
I’m just wondering if the plugin has any limit about number of rows, I should redirect thousands and I don’t know if it works. Thank you.

Care to Comment?

Or if you'd prefer to get in touch privately, please send me an email.

Name

Email (optional)

Blog (optional)