Git Product home page Git Product logo

redirection's Introduction

Redirection

PHP/JavaScript Build Status

Redirection is a WordPress plugin to manage 301 redirections, keep track of 404 errors, and generally tidy up any loose ends your site may have. This is particularly useful if you are migrating pages from an old website, or are changing the directory of your WordPress installation.

Note: this is the current 'trunk' version of Redirection. It may be newer than what is in the WordPress.org plugin repository, and should be considered experimental.

Installation

Redirection can be installed by visiting the WordPress.org plugin page:

https://wordpress.org/plugins/redirection/

Customisation

Redirection provides a large set of WordPress action and filter hooks that can be used to extend or customise the plugin. These can found on the Redirection Hooks page.

Permissions

Access to the Redirection admin interface is given to users who can manage_options. You can modify this with permission filters, described on the Redirection permissions page.

Building

Redirection is mostly a PHP plugin, but does contain files that need to be built. For this you'll need Gulp, Node, and Yarn installed. Install required modules with:

yarn install

Language files

gulp pot - Updates language files

React

Some parts of the UI are React and can be built with:

yarn build

To use in development mode then set REDIRECTION_DEV_MODE to true in PHP, and run:

yarn start

This will start Webpack in hot-reload mode, and you can make changes to JS files and have them auto-loaded.

Releasing

Finally, to produce a release copy:

gulp plugin

Support

Please raise any bug reports or enhancement requests here. Pull requests are always welcome.

You can find a more detailed description of the plugin on the Redirection home page

Translations can be added here:

https://translate.wordpress.org/projects/wp-plugins/redirection

redirection's People

Contributors

2ndkauboy avatar amhislop avatar andrewmumblebee avatar bainternet avatar booom3 avatar brazenest avatar dann2012 avatar dependabot[bot] avatar drobin03 avatar georgiee avatar iandelmar avatar johngodley avatar jordanreiter avatar junc avatar kraftner avatar liam-simmons avatar lucaslarson avatar matzeeable avatar mirucon avatar naokomc avatar ramiy avatar reitermarkus avatar rmarchant avatar robertgres avatar sherylhohman avatar spacedmonkey avatar stefanfisk avatar thomasmery avatar thunderdw avatar touuki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

redirection's Issues

var replacement to public

Replacing old properties that declared with var would be good.
Year 2014 and WordPress require at least 5.2.4 version. We don't need to generate E_STRICT warning.

Re-ordering rules not working in WP 4

There appears to be no way to re-order redirection rules, though the documentation suggests that it is possible. I'm using Wordpress 4.0 with redirection version 2.3.10

Plugin update

It seems like this version of the plugin is way more up to date the one on the official Wordpress repo. Is there any way you could sync up please?

Can't choose groups and redirections do not work

I am running a multisite (sub-domain) installation of Wordpress

At one of my multisite i can't choose groups when i am at the &sub=404s tab, the group select is empty and "add Redirection" ends up with an "Invalid group when creating redirect"-error

But the following groups are available at the &sub=groups tab
"Redirections"
"Modified Posts"

If i "Add new redirection" under the "Redirects" tab, the redirection is created but does not work, i still hit the 404 page instead of the configured redirection.

On the main site and an other multisite i could use the plugin without problems.

Wordpress: 4.1
Redirection: 2.3.11

Can't select the type of redirect.

Can't select the type of redirect. This is using match of login in status and url and regex

For example I woul like to select a 302 and it the docs it says thats possible but there is no option.

by default 2015-05-29 at 7 33 32 pm

Support for non-latin chars in the slug

It appears that if I use a non-latin chars in the slug, the redirection does not takes affect. I have a slug which is in Hebrew and the plugin fails to detect it.

invalid group ID

After updating to the new plugin version I'm getting this error Invalid group ID

Any help on fixing?

I am going into the WP-Admin
Then go to tools/reduction
The error appears

Add case insensitive matching to redirect rules

Add case insensitive matching to redirect rules option to redirect rules. Regex is not really ideal for this use case as alot of regex rules on a site can affect performance significantly.

stripos is alot faster then preg_match.

Export just reloads list

Going to the Modules tab and selecting "CSV" (or any of them for that matter) just takes you back to the Redirects list.

Adding redirections using PHP

I'm not sure if this is possible already but it would be great if we could add redirections using PHP, for example after publishing a post.

I want to redirect domain.com/xyz to domain.com/posttype/long-title-for-custom-post-type, this could be easily achievable if we could add redirects using PHP.

Don't log 410 status redirects

Add an option to not log the 410 status redirects. The idea if a 410 redirect was sent, it was very intentional based on the redirect rules and doesn't need to be logged for review.

404 export only exports the amount of how many redirection log rows there are

Currently the 404 export counts the number of 404 reports incorrectly, taking the count from the redirection log table and not from the 404 table. This means the export stops e.g. after first 300 404s, if there are 201 to 300 redirection log items. This is just a typo on the file models/log.php, on the line 244:

$sql = "SELECT COUNT(*) FROM {$wpdb->prefix}redirection_logs";

This should of course be:

$sql = "SELECT COUNT(*) FROM {$wpdb->prefix}redirection_404";

.htaccess duplication

Bug report via email from Jörg Liwa

Maybe i found a bug regarding to the storage in .htaccess file.
I hade the problem, that my .htaccess redirection entries are always duplicated instead
of replaced, so i had a look in the plugin and found, that it searches for "Created by
Redirection Module...." but in my .htaccess file there was just the line "Created by
Redirection". So i replaced the Row 176 in the file htaccess.php  with
$text .= preg_replace( '@# Created by Redirection(.*?)# End of Redirection@sm', '', $existing );
and now it works for me.

Redirection_Items is not defined

I cannot edit existing redirects. This error is displayed in the console:

Redirection_Items is not defined

And when I create a new redirect it does save, but I am taken to the /wp-admin/admin-ajax.php file and this displays the source of that file on screen.

I'm using WordPress 4.3 on Azure.

redirect with/ without trailing slash

I guess ignoring latest slash of redirect URL could be helpful.

For example, when I want to redirect /test, at the same time want to redirect /test/ as well. So don't need to add same rule twice (with or without slash)

What are you think about this @johngodley? (I can work on this enhancement)

Catchable fatal error

Hi John,

Your plugin has been helpful for us. I am unable to get into the Redirection area of the WP Dashboard as I receive the following error when I try:

Catchable fatal error: Argument 2 passed to Redirection_Table::__construct() must be an instance of Red_Group, boolean given, called in /home3/jelcoach/public_html/wp-content/plugins/redirection/redirection-admin.php on line 329 and defined in /home3/jelcoach/public_html/wp-content/plugins/redirection/models/pager.php on line 10

Cab you guide me as to how this should be fixed?

Thanks so much!

Dale

Fatal Error when uploading redirects in 2.3.6

PHP Error Log Below

[25-Jul-2014 21:43:58 UTC] PHP Fatal error:  Cannot instantiate abstract class Red_FileIO in /source/blogs/wordpress/wp-content/plugins/redirection/redirection.php on line 294
[25-Jul-2014 21:43:58 UTC] PHP Stack trace:
[25-Jul-2014 21:43:58 UTC] PHP   1. {main}() /source/blogs/wordpress/wp-admin/tools.php:0
[25-Jul-2014 21:43:58 UTC] PHP   2. require_once() /source/blogs/wordpress/wp-admin/tools.php:10
[25-Jul-2014 21:43:58 UTC] PHP   3. do_action() /source/blogs/wordpress/wp-admin/admin.php:211
[25-Jul-2014 21:43:58 UTC] PHP   4. call_user_func_array() /source/blogs/wordpress/wp-includes/plugin.php:470
[25-Jul-2014 21:43:58 UTC] PHP   5. Redirection->admin_screen() /source/blogs/wordpress/wp-includes/plugin.php:0
[25-Jul-2014 21:43:58 UTC] PHP   6. Redirection->admin_screen_options() /source/blogs/wordpress/wp-content/plugins/redirection/redirection.php:178

Redirection: 404s no longer appearing

I have Redirection on 2 sites. On one, all remains normal. On the other (with Karma theme) all was normal., then it changed. Re-directs continue to work, but 404s no longer show up. I've tried changing the length of time logs are stored, but still no 404 ever appears. Is there an easy fix?
Thanks, Mike, Communication Director, EndHunger.org

Exclude IPs from log

It would be kinda neat when I could exclude certain IP's or certain pages from logging. This would keep my 404 log cleaner and more manageble

URL Modification redirect is not created for normal pages

I am using Wordpress 4.2.

When I change the slug of a standard wordpress page, a modified posts redirect is not created and the old URL return an 404 error.

Browsing your code, I probably found the culprit:

if ( $post->post_status != 'publish' || is_post_type_hierarchical( $post->post_type ) )

is_post_type_hierarchical returns true and prevents the creation. When I comment out this condition, everything works again. This check has been introduced long ago in 1e79f03 so I wonder if a recent Wordpress version changed behavior, I cannot imagine a bug this grave be unnoticed for years. Do you remember why you introduced this check in the first place?

Import issues

Howdy!

I'm having an issue with importing a .csv. What's the best information I can give you to help guide this issue along?

WP CLI

It would be cool to have a WP CLI interface for the import and export of CSVs. Would you interesting in writing this / willing to look at pull request?

Doesn't work with accent

I'm trying to move a Drupal to Wordpress.
There was some urls with accents, I created all the redirections but it's doesn't redirect if the url as an accent (I want to redirect an accented URL to a Wordpress sanitized url (without accent so)), but it's seems that Wordpress move to a 404 directly if it's found an accent in the URL...

New posts triggering false modified posts redirect

We're using an unconventional permalink infrastructure for our sites:

Single posts: site.com/{category}/{post_name}
Category archives: site.com/{category}

Whenever a new post is published, a modified post is triggered for that category that points /{category} to /{category}/post-that-was-published.

We've disabled the modified post functionality but this seems like something that might be a bug for someone who wants to use the modified post feature.

Show previous URLs on edit page

Suggestion from Ken Gagne:

Rather than maintain the page's official slug and the redirection aliases separately,
it'd be useful if I could view the aliases right from the post edit screen.  Maybe there'd
be a custom field right near "Slug" called "Alternative URLs", and I could create
redirections right from there.

Possible to have a "Hits" column in the 404's logs?

With robots, hacker's scripts and other garbage is very hard to actually analyze this log; I need to export it and analyze it. Actually what I need is mainly a "Hits" column in the 404's logs and to order it by this number of occurrences. That way I could easily detect the most visited 404 pages and they should be the ones requiring a fix. Would that be possible to add? Thanks a lot, this plugin is awesome otherwise.

Finer user permissions

Allow finer user permissions and/or the ability to disable certain features. This will allow Redirection to be used on sites where you may not want people to have access to all the features.

Better handling of encoded URLs in redirects

Redirection sometimes fails for URLs that should successfully redirect when portions of the URL have been encoded. There's also a need to handle '?' more intelligently sometimes in the redirects (yes, I know this is a totally invalid to include in the URL in this way, but not everyone publishing content online is savvy enough to get it right every time) This small tweak for Red_Item::get_for_url addresses both issues.

    $sql = $wpdb->prepare( "SELECT @redirection_items.*,@redirection_groups.tracking,@redirection_groups.position AS group_pos,@redirection_modules.id AS module_id FROM @redirection_items INNER JOIN @redirection_groups ON @redirection_groups.id=@redirection_items.group_id AND @redirection_groups.status='enabled' INNER JOIN @redirection_modules ON @redirection_modules.id=@redirection_groups.module_id AND @redirection_modules.type=%s WHERE( @redirection_items.regex=1 OR @redirection_items.url=%s)", $type, $url );

Becomes:

    $sql = $wpdb->prepare( "SELECT @redirection_items.*,@redirection_groups.tracking,@redirection_groups.position AS group_pos,@redirection_modules.id AS module_id FROM @redirection_items INNER JOIN @redirection_groups ON @redirection_groups.id=@redirection_items.group_id AND @redirection_groups.status='enabled' INNER JOIN @redirection_modules ON @redirection_modules.id=@redirection_groups.module_id AND @redirection_modules.type=%s WHERE( @redirection_items.regex=1 OR @redirection_items.url=%s OR @redirection_items.url=%s OR @redirection_items.url=%s)", $type, $url, urldecode($url), str_replace('?', '', urldecode($url)));

Redirect log changes

First of all, thank you for making it a bit easier to replace an old website.

I have however some suggestions that, in my opinion, would make Redirection a lot more effective.

  1. Add option to combine identical URLs in the 404s tab, and let me match all occurances in one operation.
  2. In addition, add option to delete URL from log once redirected.
  3. When clicking the "Add redirect" link, move focus and view to the Target URL input box.

If this was implemented it would make replacing a site hell of a lot easier! :)

Case insensitive redirects

Hello, love the ease of the plugin.
I would request adding an option for case insensitivity to the source URL. As I went thru the support at wordpress.org I realized you had to hard code all of the options.
Thanks!

Catchable fatal error

I just moved hosting to godaddy's Managed WordPress hosting. I am now getting the following error:

Catchable fatal error: Argument 2 passed to Redirection_Table::__construct() must be an instance of Red_Group, boolean given, called in /home/content/p3pnexwpnas03_data01/25/2313525/html/wp-content/plugins/redirection/redirection.php on line 371 and defined in /home/content/p3pnexwpnas03_data01/25/2313525/html/wp-content/plugins/redirection/models/pager.php on line 10

Is there a fix for this?

https://wordpress.org/plugins/redirection/

Override is_regex check on CSV import

I'd love the ability to override the is_regex check when importing CSVs. Maybe a third column in the CSV indicating whether to import as a regex? Or perhaps the ability to filter the is_regex check to force returning true or false?

Thanks for a great plugin!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.