Simple 301 Redirects - Version 1.02

Version Description

  • Added support for special characters in non-english URLs.
  • Fixed a case sensitivity bug.
Download this release

Release Info

Developer scottnelle
Plugin Icon 128x128 Simple 301 Redirects
Version 1.02
Comparing to
See all releases

Code changes from version 1.01 to 1.02

Files changed (2) hide show
  1. readme.txt +6 -1
  2. wp-simple-301-redirects.php +4 -4
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: scottnelle
3
  Tags: 301, redirect, url, seo
4
  Requires at least: 1.5
5
  Tested up to: 3.0
6
- Stable tag: 1.01
7
 
8
  Simple 301 Redirects provides an easy method of redirecting requests to another page on your site or elsewhere on the web.
9
 
@@ -25,6 +25,11 @@ Note: The format for requests is '/about.htm' and the format for redirects is 'h
25
 
26
  == Changelog ==
27
 
 
 
 
 
 
28
  = 1.01 =
29
  * Updated redirect method to send headers directly rather than using wp_redirect() because it was sending 302 codes on some servers
30
 
3
  Tags: 301, redirect, url, seo
4
  Requires at least: 1.5
5
  Tested up to: 3.0
6
+ Stable tag: 1.02
7
 
8
  Simple 301 Redirects provides an easy method of redirecting requests to another page on your site or elsewhere on the web.
9
 
25
 
26
  == Changelog ==
27
 
28
+ = 1.02 =
29
+ * Added support for special characters in non-english URLs.
30
+ * Fixed a case sensitivity bug.
31
+
32
+
33
  = 1.01 =
34
  * Updated redirect method to send headers directly rather than using wp_redirect() because it was sending 302 codes on some servers
35
 
wp-simple-301-redirects.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Simple 301 Redirects
4
  Plugin URI: http://www.scottnelle.com/simple-301-redirects-plugin-for-wordpress/
5
  Description: Create a list of URLs that you would like to 301 redirect to another page or site
6
- Version: 1.01
7
  Author: Scott Nellé
8
  Author URI: http://www.scottnelle.com/
9
  */
@@ -115,15 +115,15 @@ if (!class_exists("Simple301redirects")) {
115
  */
116
  function redirect()
117
  {
118
- // this is what the user asked for
119
- $userrequest = str_replace(get_option('home'),'',$this->getAddress());
120
  $userrequest = rtrim($userrequest,'/');
121
 
122
  $redirects = get_option('301_redirects');
123
  if (!empty($redirects)) {
124
  foreach ($redirects as $storedrequest => $destination) {
125
  // compare user request to each 301 stored in the db
126
- if($userrequest == rtrim($storedrequest,'/')) {
127
  header ('HTTP/1.1 301 Moved Permanently');
128
  header ('Location: ' . $destination);
129
  exit();
3
  Plugin Name: Simple 301 Redirects
4
  Plugin URI: http://www.scottnelle.com/simple-301-redirects-plugin-for-wordpress/
5
  Description: Create a list of URLs that you would like to 301 redirect to another page or site
6
+ Version: 1.02
7
  Author: Scott Nellé
8
  Author URI: http://www.scottnelle.com/
9
  */
115
  */
116
  function redirect()
117
  {
118
+ // this is what the user asked for (strip out home portion, case insensitive)
119
+ $userrequest = str_ireplace(get_option('home'),'',$this->getAddress());
120
  $userrequest = rtrim($userrequest,'/');
121
 
122
  $redirects = get_option('301_redirects');
123
  if (!empty($redirects)) {
124
  foreach ($redirects as $storedrequest => $destination) {
125
  // compare user request to each 301 stored in the db
126
+ if(urldecode($userrequest) == rtrim($storedrequest,'/')) {
127
  header ('HTTP/1.1 301 Moved Permanently');
128
  header ('Location: ' . $destination);
129
  exit();