Plugin Directory

Changeset 2423402


Ignore:
Timestamp:
11/23/2020 08:05:48 AM (5 years ago)
Author:
zuda
Message:

improved redirects for redirect editor

Location:
redirect-editor/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • redirect-editor/trunk/readme.txt

    r2379993 r2423402  
    55Tags:  redirect, improve security, hacking, wordpress security,  wp security, SEO, security plugin, redirection, htaccess,
    66Requires at least: 3.0
    7 Tested up to: 5.5.1
     7Tested up to: 5.5.4
    88Stable tag: trunk
    99License: GPLv2 or later
     
    53531. Redirect editor is easy to use, you just type in the page you want redirected as shown in the example and then put the link to where we are redirecting to. It is the simplest redirect tool for seo and gives an accurate 301 response for WP. The other features help secure your site and currently happen in the background without any interaction, besides activating the plugin.
    5454
     55== 2.3.7 ==
     56improved redirects!
    5557
    5658== 2.3.6 ==
  • redirect-editor/trunk/redirect-editor.php

    r2379993 r2423402  
    33/*
    44Plugin Name: Search Engine Optimization Redirect Editor
    5 Version: 2.3.6
     5Version: 2.3.7
    66Plugin URI: https://planetzuda.com
    77Description: If you need to redirect whether for search engine optimization purposes or otherwise you can use our app to  redirect to any page. We provide a direct link to your xml sitemap which you can submit to search engines manually.  We  protect you against popular SEO plugins that damage your rankings by making your sitemap invisible to Google's bots by telling them to not index it, which is a free and automatically applied feature. More search features are coming. Our redirect editor is extremely useful and highly secure, which has been tested in bug bounties by white hat hackers, including our security and seo company.
     
    329329
    330330    /* currently only allowing text, but will be adding in more support in the future. */
    331  public function PZ_security_protection()
    332     {
    333        
     331
     332    public function PZ_security_protection()
     333    {
     334        $disable_api = $this->get_setting('disable_api');
    334335        $_req_uri = esc_url($_SERVER["REQUEST_URI"]);
    335        
    336         if (preg_match('/^.*\/wp-json*/', $_req_uri) && $disable_api === 1) {
    337            
    338             wp_redirect(get_home_url(), 301);
    339             exit();
    340         }
    341  }
    342      public function redirect($query)
     336
     337      if(isset($disable_api)){
     338      $disable_api=  intval($disable_api);
     339      }
     340  add_action('pre_get_posts', array(
     341            $this,
     342            'redirect'
     343        ));
     344
     345      if (preg_match('/^.*\/wp-json\/*/', $_req_uri) && $disable_api === 1) {
     346
     347     
     348
     349        if (current_user_can('edit_posts')) {
     350            add_action('wp_head', 'rsd_link'); // add really simple discovery link
     351            add_action('wp_head', 'wlwmanifest_link'); // add windows live writer link
     352            add_action('wp_head', 'wp_shortlink_wp_head', 10);
     353
     354            add_action('the_generator', 'erase_header_junk'); // add it
     355        }
     356}
     357  }
     358
     359     public function redirect($query)
    343360    {
    344361        if ($query->is_main_query() && ! current_user_can('manage_options') || $query->is_main_query() && current_user_can('manage_options')) {
     
    358375
    359376
    360 
    361377?>
Note: See TracChangeset for help on using the changeset viewer.