Jesin's Blog

Welcome to the Portal of Technology

  • Facebook
  • GitHub
  • RSS
  • Twitter
  • Home
  • Categories
    • Domains
    • Linux
    • Networking
    • PHP
    • Virtualization
    • Web Design
    • Web Servers
    • Windows
  • WordPress Plugins
    • Custom Error Pages
    • HTTP Digest Authentication
    • Mailgun Email Validator
  • Toolbox
    • DNS Lookup Tool
    • htdigest Generator Tool Online
    • htpasswd Generator Tool Online
    • HTTP Headers Lookup Tool
    • MD5 Encryption Tool
    • Open Port Check Tool
    • SHA-1 Encryption Tool
    • URL Encoding/Decoding Tool
  • About Me
  • Contact Me
  • Sitemap
Home ›
Jesin A

WP CLI fix “Warning: Some code is trying to do a URL redirect.” error

July 22, 2018 Web Design Jesin A Leave a Comment

The WordPress command-line interface is incredibly useful when changing the domain URL of a website. When working on a client’s website I encountered the following warning when I ran the wp search-replace command.

Warning: Some code is trying to do a URL redirect. Backtrace:
#0  WP_CLI\Utils\wp_redirect_handler(http://example.com/) called at [/srv/users/serverpilot/apps/APPNAME/public/wp-includes/class-wp-hook.php:288]
#1  WP_Hook->apply_filters(http://example.com/, Array ([0] => http://example.com/,[1] => 301)) called at [/srv/users/serverpilot/apps/APPNAME/public/wp-includes/plugin.php:203]
#2  apply_filters(wp_redirect, http://example.com/, 301) called at [/srv/users/serverpilot/apps/APPNAME/public/wp-includes/pluggable.php:1199]
#3  wp_redirect(http://example.com/, 301) called at [/srv/users/serverpilot/apps/APPNAME/public/wp-content/plugins/quick-pagepost-redirect-plugin/page_post_redirect_plugin.php:2151]
#4  quick_page_post_reds->redirect() called at [/srv/users/serverpilot/apps/APPNAME/public/wp-includes/class-wp-hook.php:286]
#5  WP_Hook->apply_filters(, Array ([0] => )) called at [/srv/users/serverpilot/apps/APPNAME/public/wp-includes/class-wp-hook.php:310]
#6  WP_Hook->do_action(Array ([0] => )) called at [/srv/users/serverpilot/apps/APPNAME/public/wp-includes/plugin.php:453]
#7  do_action(init) called at [/srv/users/serverpilot/apps/APPNAME/public/wp-settings.php:450]
#8  require(/srv/users/serverpilot/apps/APPNAME/public/wp-settings.php) called at [phar:///opt/sp/bin/wp-cli.phar/php/WP_CLI/Runner.php:1174]
#9  WP_CLI\Runner->load_wordpress() called at [phar:///opt/sp/bin/wp-cli.phar/php/WP_CLI/Runner.php:1100]
#10 WP_CLI\Runner->start() called at [phar:///opt/sp/bin/wp-cli.phar/php/WP_CLI/Bootstrap/LaunchRunner.php:23]
#11 WP_CLI\Bootstrap\LaunchRunner->process(WP_CLI\Bootstrap\BootstrapState Object ([WP_CLI\Bootstrap\BootstrapStatestate] => Array ())) called at [phar:///opt/sp/bin/wp-cli.phar/php/bootstrap.php:75]
#12 WP_CLI\bootstrap() called at [phar:///opt/sp/bin/wp-cli.phar/php/wp-cli.php:23]
#13 include(phar:///opt/sp/bin/wp-cli.phar/php/wp-cli.php) called at [phar:///opt/sp/bin/wp-cli.phar/php/boot-phar.php:8]
#14 include(phar:///opt/sp/bin/wp-cli.phar/php/boot-phar.php) called at [/opt/sp/bin/wp-cli.phar:4]

Googling this warning message brought up several links to GitHub which all recommended using the --user=someadmin parameter. I tried that too but got the same warning. Looking at the backtrace log it is clear that the quick-pagepost-redirect-plugin is causing this redirect, so I used the --skip-plugins= parameter to skip loading this plugin.

wp search-replace --skip-plugins=quick-pagepost-redirect-plugin 'http://example.com' 'https://example.com' --skip-columns=guid

And I had no issues running the search and replace operation.

On a sidenote if you are looking for a shared web host with WP CLI support choose SiteGround (affiliate link). They also have other WordPress specific features like automated migration and caching.

Tags: wordpress, wp-cli

How to setup AutoSSL on a free ServerPilot plan

May 9, 2017 Web Servers Jesin A 11 Comments

ServerPilot the lightweight hosted control panel integrates well with Let’s Encrypt to generate free SSL certificates with a click of a button. ServerPilot calls this feature AutoSSL and makes it available only on the Coach plan that costs $10/month/server. But by using some custom Nginx configuration we can get Let’s Encrypt working on the free plan. That means you can have an unlimited number of SSL certificates that automatically renew once in three months.

If you haven’t tried ServerPilot, use my referral link to sign up and earn $10 in credit 🙂Continue Reading…

Tags: letsencrypt, serverpilot, ssl

How to add the HSTS header only for HTTPS requests on Nginx

September 22, 2016 Web Servers Jesin A Leave a Comment

security padlock

HTTP Strict Transport Security is a mechanism through which web servers declare themselves to be accessible only over secure connections (HTTPS). This mechanism is implemented by configuring the web server to send a HSTS header in its responses. A typical HSTS header looks like the following:

Strict-Transport-Security: max-age=31536000; includeSubDomains

The RFC standard for HTTP Strict Transport Security – RFC6797 specifies under Section 7.2 that a web server should not include this header in plain-text HTTP responses.Continue Reading…

Tags: nginx, ssl

How to setup SSL certificates on a free ServerPilot plan

April 11, 2016 Linux, Web Servers Jesin A 2 Comments

https icon

Installing SSL certificates on ServerPilot requires a paid plan. But thanks to the amount of customizability offered by ServerPilot’s config files we can configure SSL certificates on the free plan.

Create a directory for each domain’s SSL certificate files.

sudo mkdir /etc/ssl/example.com

Generate a private key in this directory.Continue Reading…

Tags: serverpilot, ssl

How to configure Linode Longview on ServerPilot

December 29, 2015 Linux Jesin A 6 Comments

linode logo

Longview is a system statistics graphing service by Linode. The statistics for CPU, memory, network, Disk I/O, MySQL, Apache and Nginx are collected by an agent program and are graphed in the Linode control panel. This service can also be used on servers that are not hosted on Linode. This article will show you how to setup Longview for monitoring a ServerPilot stack.Continue Reading…

Tags: serverpilot

How to install PHPMyAdmin on an Nginx Web Server

July 16, 2015 Linux, Web Servers Jesin A 6 Comments

nginx phpmyadmin thumbnail

This article will show you how to install the latest version of PHPMyAdmin on Nginx. We will be obtaining the latest stable version of PHPMyAdmin from the GitHub repository and periodically pull updates for it via Git.

Create a directory for PHPMyAdmin and change its ownership to the www-data user.
Continue Reading…

Tags: nginx, phpmyadmin

  • 1
  • 2
  • 3
  • …
  • 25
  • Next Page »

Get a wealth of information delivered to your inbox. Subscribe and never miss a single article.

  • Tutorials and howtos
  • Code, scripts and commands
  • Online Tools

* No spam, unsubscribe anytime

Hire Me

  • SSL installation and hardening (A+ on Qualys SSL test)
  • Apache & Nginx configuration
  • Email deliverability improvement (10/10 on Mail Tester & MailGenius)
  • WordPress customization, optimization and migration
  • and much more…

    Tools

    • DNS Lookup Tool
    • htdigest Generator Tool Online
    • htpasswd Generator Tool Online
    • HTTP Headers Lookup Tool
    • MD5 Encryption Tool
    • Open Port Check Tool
    • SHA-1 Encryption Tool
    • URL Encoding/Decoding Tool

    Nav

    • Home
    • About Me
    • Contact Me
    • Privacy Policy
    • Sitemap
    Vultr SSD VPS

    Creative Commons License
    Jesin's Blog by Jesin A is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
    Based on a work at websistent.com.