Skip to content
  • Quick Ref
  • Contact
  • About
wpcanyon.com

wpcanyon.com

Tag: Cache

Fix WordPress too many redirects (ERR_TOO_MANY_REDIRECTS)

Posted on August 19, 2025 By Admin No Comments on Fix WordPress too many redirects (ERR_TOO_MANY_REDIRECTS)

Fix WordPress too many redirects (ERR_TOO_MANY_REDIRECTS)

If you encounter the ERR_TOO_MANY_REDIRECTS error on your WordPress site, it means your browser is stuck in an infinite redirect loop. This prevents your site from loading properly and frustrates visitors. The quick fix usually involves correcting your WordPress URL settings or your server’s redirect rules.

Quick Fix

  1. Access your WordPress database via phpMyAdmin or a similar tool.
  2. Locate the wp_options table.
  3. Find the siteurl and home entries.
  4. Ensure both URLs use the same protocol (http or https) and domain, for example: https://example.com.
  5. Clear your browser cache and cookies.
  6. If you use a caching or redirect plugin, temporarily disable it.

Alternatively, you can add the following lines to your wp-config.php file to hardcode the URLs:

define('WP_HOME','https://example.com');
define('WP_SITEURL','https://example.com');

Replace https://example.com with your actual site URL.

Why This Happens

The ERR_TOO_MANY_REDIRECTS error occurs when your browser is redirected between URLs repeatedly without reaching the final destination. Common causes include:

  • Mismatched URL settings: WordPress URL settings use HTTP while your site forces HTTPS (or vice versa).
  • Conflicting redirect rules: Server-level redirects (in .htaccess or Nginx config) conflict with WordPress or plugin redirects.
  • Plugin conflicts: Plugins that handle redirects or SSL can cause loops if misconfigured.
  • Incorrect SSL setup: Partial SSL implementation or mixed content issues.

Step-by-step Fix for Nginx and Apache (cPanel/Plesk)

1. Check WordPress URL Settings

Make sure WordPress URLs are consistent and correct.

-- Access your database via phpMyAdmin or command line
SELECT option_name, option_value FROM wp_options WHERE option_name IN ('siteurl', 'home');

-- Update URLs if needed
UPDATE wp_options SET option_value = 'https://example.com' WHERE option_name = 'siteurl';
UPDATE wp_options SET option_value = 'https://example.com' WHERE option_name = 'home';

2. Fix wp-config.php (optional)

Add these lines to enforce correct URLs:

define('WP_HOME','https://example.com');
define('WP_SITEURL','https://example.com');

3. Review Apache .htaccess Redirects (cPanel/Plesk)

Check your .htaccess file in the WordPress root directory for conflicting redirects. A typical WordPress .htaccess looks like this:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

If you have HTTPS redirects, ensure they are correct and not looping:

# Redirect HTTP to HTTPS
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]

4. Review Nginx Redirects

Check your Nginx server block configuration for redirect loops. A proper HTTPS redirect looks like this:

server {
    listen 80;
    server_name example.com www.example.com;
    return 301 https://example.com$request_uri;
}

server {
    listen 443 ssl;
    server_name example.com www.example.com;

    ssl_certificate /path/to/cert.pem;
    ssl_certificate_key /path/to/key.pem;

    root /var/www/html;
    index index.php index.html index.htm;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ .php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
    }
}

5. Disable Redirect or SSL Plugins

Temporarily deactivate plugins like Really Simple SSL, Redirection, or any caching plugins that might cause redirect loops.

6. Clear Browser and Server Cache

Clear your browser cache and cookies. Also clear any server-side caches (e.g., LiteSpeed cache, Varnish, or CDN caches).

Works on

  • Web servers: Apache, Nginx, LiteSpeed
  • Hosting control panels: cPanel, Plesk
  • WordPress versions: 4.x, 5.x, 6.x
  • SSL setups: Let’s Encrypt, commercial SSL certificates

FAQ

Q1: Why does ERR_TOO_MANY_REDIRECTS happen only on some browsers?

Browser cache or cookies can cause this error to appear inconsistently. Clearing cache and cookies usually resolves this.

Q2: Can a plugin cause redirect loops?

Yes. Plugins that manage redirects, SSL, or caching can conflict with server redirects or WordPress settings, causing loops.

Q3: How do I know if my SSL is causing the redirect loop?

If your WordPress URLs use HTTPS but your server redirects HTTP to HTTPS incorrectly or partially, it can cause loops. Verify SSL configuration and redirects.

Q4: Is it safe to hardcode URLs in wp-config.php?

Yes, hardcoding WP_HOME and WP_SITEURL is a quick way to fix URL mismatches but should be used carefully to avoid issues during migrations.

Q5: What if none of these fixes work?

Check your server error logs, disable all plugins and switch to a default theme to isolate the issue. Contact your hosting provider if needed.…

Fixes & Errors

BunnyCDN setup for WordPress (origin shield & query‑string cache)

Posted on August 19, 2025 By Admin No Comments on BunnyCDN setup for WordPress (origin shield & query‑string cache)

BunnyCDN Setup for WordPress (Origin Shield & Query-String Cache)

If you want to speed up your WordPress site globally and reduce server load, BunnyCDN is a reliable, cost-effective CDN solution. However, configuring BunnyCDN properly—especially with origin shield and query-string caching—can be tricky. This guide provides a quick fix and detailed steps to set up BunnyCDN with WordPress, ensuring optimal caching behavior and improved site performance.

Quick Fix: BunnyCDN WordPress Setup with Origin Shield & Query-String Cache

  1. Create a BunnyCDN Pull Zone pointing to your WordPress origin server.
  2. Enable Origin Shield in BunnyCDN dashboard to reduce origin hits.
  3. Configure BunnyCDN to cache query-string parameters correctly.
  4. Set appropriate cache-control headers in WordPress (via .htaccess or functions.php).
  5. Update your WordPress URLs to use the BunnyCDN Pull Zone URL.
  6. Test caching behavior and purge cache when necessary.

Why This Happens

WordPress sites often serve dynamic content with query strings (e.g., ?product_id=123), which many CDNs do not cache by default or cache incorrectly. Without proper query-string caching, users may get stale or incorrect content. Additionally, frequent origin requests can overload your server, especially during traffic spikes.

BunnyCDN’s Origin Shield acts as an additional caching layer between your origin and the CDN edge nodes, reducing origin load. Properly configuring query-string caching ensures that BunnyCDN caches unique versions of pages based on query parameters, improving cache hit ratio and user experience.

Requirements

  • Active BunnyCDN account
  • WordPress site with admin access
  • Access to your web server configuration (Apache, Nginx, or via cPanel/Plesk)
  • Basic knowledge of editing WordPress theme files or .htaccess

Step-by-step BunnyCDN WordPress Setup

1. Create a BunnyCDN Pull Zone

  1. Log in to your BunnyCDN dashboard.
  2. Go to Pull Zones and click Add Pull Zone.
  3. Enter a name (e.g., mywpsite), and set your WordPress site URL as the origin URL.
  4. Click Add Pull Zone and wait for the zone to be created.

2. Enable Origin Shield

  1. In your Pull Zone settings, navigate to the Origin Shield tab.
  2. Enable Origin Shield and select the closest region to your origin server.
  3. Save changes.

3. Configure Query-String Caching

  1. Go to the Cache tab in your Pull Zone settings.
  2. Under Query String Caching, select Cache every unique URL.
  3. Optionally, specify which query parameters to include or exclude.
  4. Save changes.

4. Set Cache-Control Headers in WordPress

To ensure BunnyCDN caches your content correctly, set proper cache-control headers. You can do this via .htaccess (Apache) or via WordPress functions.

Apache (.htaccess) example:

# BEGIN BunnyCDN Cache-Control
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType text/html "access plus 1 hour"
  ExpiresByType image/jpeg "access plus 1 month"
  ExpiresByType image/png "access plus 1 month"
  ExpiresByType text/css "access plus 1 week"
  ExpiresByType application/javascript "access plus 1 week"
</IfModule>

<IfModule mod_headers.c>
  Header set Cache-Control "public, max-age=3600"
</IfModule>
# END BunnyCDN Cache-Control

WordPress functions.php example:

function add_cache_control_headers() {
    if (is_admin()) return;
    header('Cache-Control: public, max-age=3600');
}
add_action('send_headers', 'add_cache_control_headers');

5. Replace URLs in WordPress to Use BunnyCDN

Update your WordPress URLs to serve static assets (images, CSS, JS) via BunnyCDN.

  • Use a plugin like Better Search Replace to replace URLs in your database from https://yourdomain.com/wp-content/ to https://yourpullzone.b-cdn.net/wp-content/.
  • Alternatively, use the WP Rocket or W3 Total Cache plugins to rewrite URLs for static files.

6. Test and Purge Cache

  1. Visit your site and inspect network requests to verify assets load from BunnyCDN URL.
  2. Use BunnyCDN’s cache control headers checker or browser dev tools to confirm caching.
  3. If you update content, purge BunnyCDN cache from the dashboard or via API.

Common Pitfalls

  • Not enabling query-string caching: Dynamic pages may serve stale or incorrect content.
  • Incorrect cache-control headers: BunnyCDN may not cache content or cache it too long.
  • Forgetting to update URLs: Static assets won’t load from BunnyCDN, missing performance benefits.
  • Origin Shield region mismatch: Selecting a distant region can increase latency.
  • Plugin conflicts: Some caching or security plugins may interfere with headers or CDN URLs.

Works on

Environment Notes
Apache Supports .htaccess cache headers and URL rewrites.
Nginx Requires manual config for cache-control headers; BunnyCDN works seamlessly.
LiteSpeed Compatible with .htaccess and cache headers.
cPanel / P
…
Speed & Security

Fix WordPress login loop (keeps redirecting to login)

Posted on August 19, 2025 By Admin No Comments on Fix WordPress login loop (keeps redirecting to login)

Fix WordPress login loop (keeps redirecting to login)

If you are trying to log into your WordPress admin dashboard but keep getting redirected back to the login page, you are stuck in a frustrating login loop. This issue, commonly known as the WordPress login loop keeps redirecting, prevents access to your site’s backend and can disrupt your workflow. Fortunately, there are straightforward fixes to resolve this problem quickly.

This article explains why the login loop happens and provides a quick copy/paste fix. It also walks you through detailed steps for different server environments like Nginx, Apache, cPanel, and Plesk.

Quick Fix

  1. Clear your browser cookies and cache for your site.
  2. Check and reset your WordPress site URL and home URL in wp-config.php:
define('WP_HOME','https://yourdomain.com');
define('WP_SITEURL','https://yourdomain.com');
  1. Disable all plugins by renaming the wp-content/plugins folder via FTP or file manager.
  2. Switch to a default theme by renaming your active theme folder in wp-content/themes.
  3. Ensure your .htaccess file (Apache) or Nginx config is correct and not causing redirects.
  4. Check your server’s PHP session and cookie settings.

Why this happens

The WordPress login loop usually occurs due to one or more of the following reasons:

  • Incorrect site URL settings: If the WordPress Address (URL) and Site Address (URL) do not match or are misconfigured, WordPress redirects you back to login.
  • Corrupted or conflicting plugins/themes: Plugins or themes that interfere with authentication or cookies can cause the loop.
  • Browser cookies or cache issues: Old or corrupted cookies can prevent proper login sessions.
  • Server misconfiguration: Incorrect rewrite rules in .htaccess or Nginx config files, or PHP session problems, can break login flow.
  • HTTPS and SSL issues: Mixed content or forced HTTPS redirects without proper configuration can cause redirect loops.

Step-by-step

1. Clear Browser Cookies and Cache

Before making server changes, clear your browser’s cookies and cache for your site domain to eliminate stale session data.

2. Set Correct Site URL in wp-config.php

  1. Access your site files via FTP, SFTP, or your hosting file manager.
  2. Open wp-config.php in the root WordPress directory.
  3. Add these lines just above the line that says /* That's all, stop editing! Happy blogging. */:
define('WP_HOME','https://yourdomain.com');
define('WP_SITEURL','https://yourdomain.com');

Replace https://yourdomain.com with your actual site URL including https if SSL is enabled.

3. Disable All Plugins

  1. Rename the wp-content/plugins folder to plugins-disabled via FTP or file manager.
  2. Try logging in again. If successful, a plugin is causing the issue.
  3. Rename the folder back to plugins and reactivate plugins one by one to find the culprit.

4. Switch to a Default Theme

  1. Rename your active theme folder in wp-content/themes (e.g., twentytwentyone to twentytwentyone-disabled).
  2. WordPress will fallback to a default theme like Twenty Twenty-One.
  3. Try logging in again.

5. Check and Reset .htaccess (Apache)

  1. Backup and delete your current .htaccess file in the WordPress root directory.
  2. Create a new .htaccess file with the default WordPress rules:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
  1. Save and test login again.

6. Check Nginx Configuration

Ensure your Nginx config includes the correct rewrite rules for WordPress. A typical configuration looks like this:

location / {
    try_files $uri $uri/ /index.php?$args;
}

If you have forced HTTPS or redirects, verify they do not conflict with login URLs.

7. Verify PHP Session and Cookie Settings

  • Make sure PHP sessions are enabled and writable on your server.
  • Check php.ini for proper session.save_path and cookie parameters.
  • Confirm your site uses consistent HTTP or HTTPS URLs to avoid cookie mismatches.

Works on

Server Control Panel Web Server
Shared Hosting, VPS, Dedicated cPanel, Plesk, DirectAdmin Apache, Nginx, LiteSpeed

This guide applies to most typical WordPress hosting environments including Apache and Nginx servers managed via cPanel or Plesk.

FAQ

Q1: Why does clearing cookies fix the login loop?
Cookies store your login session data. If they become corrupted or outdated, WordPress cannot validate your login, causing a redirect loop. Clearing cookies resets this data.
Q2: Can a plugin cause the login loop?
Yes. Plugins that handle authentication, security, or redirects can interfere with login sessions. Disabling all plugins helps identify if one is responsible
…
Fixes & Errors

Recent Posts

  • Top WordPress Themes for Blogs in 2025
  • WordPress Admin Panel Trick: Adding ID Field to the Posts Listing
  • Solution previous_posts_link and next_posts_link Not Working
  • Show Top Commentators in WordPress Without a Plugin
  • How to Style Admin Comments in WordPress

Recent Comments

    Archives

    • August 2025

    Categories

    • Admin & Blocks
    • Admin & UI
    • Automation
    • Automation & Plugins
    • Comments
    • Comparisons
    • Database & Revisions
    • Developer Snippets
    • Fixes & Errors
    • Media & Thumbnails
    • Queries & Pagination
    • Security
    • Speed & Security
    • Tips & Tricks
    • WooCommerce How‑tos
    • WordPress Snippets
    • WordPress Themes
    • Terms & Conditions
    • Affiliate Disclosure

    Copyright © 2025 wpcanyon.com.

    Powered by PressBook WordPress theme

    Also by the maker of MySurveyReviews.com