Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6093775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:35:59+00:00 2026-05-23T12:35:59+00:00

I have a WordPress installation and a few months ago I decided to change

  • 0

I have a WordPress installation and a few months ago I decided to change the theme. The new theme required to change the total posts per page from 8 that was in the first theme to 10 in the next theme, so the new theme as expected does not have all of the pages that previews theme had.

The problem is that now Google looking for page /archives/tag/tag-name/page/5 while that page does not exists.

What I need to do is to make a rewrite rule, for the case that the page does not exists to redirect with 307 (Temporary moved on) on the root tag or category page in a URL that will looks like that /archives/tag/tag-name/

In my htaccess I have try that :

RewriteEngine On
RewriteBase /

# Check if any tag has a page that not exists 
# and redirect to first page of this category
RewriteCond ^archives/tag/.*/page/[0-9]+(/?)$ !-f
RewriteRule ^archives/tag/(.*)/page/[0-9]+(/?)$ http://www.my-site.ext/archives/tag/$1/ [L,R=307]

# Check if any category has a page that not exists 
# and redirect to first page of this category
RewriteCond ^archives/category/.*/page/[0-9]+(/?)$ !-f
RewriteRule ^archives/category/(.*)/page/[0-9]+(/?)$ http://www.my-site.ext/archives/category/$1/ [L,R=307]

# Default wordpress rewrite rules
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

But the above rules redirect the existing pages too, in the first page

Any help please ? 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T12:35:59+00:00Added an answer on May 23, 2026 at 12:35 pm

    I think what you’d need to do is handle this at the WordPress level, not Apache.

    In your theme’s functions.php file, try hooking the “template_redirect” action, something like this:

    function nikos_redirect_paginated_404() {
      if (is_404() && [other conditions]) {
        wp_redirect($some_better_url, '307');
        exit;
      }
    }
    
    add_action('template_redirect', 'nikos_redirect_paginated_404');
    

    You’ll have to figure out the right logic for [other conditions] and $some_better_url yourself.

    (This general idea is based on the wp_old_slug_redirect function, which is found in WordPress’s query.php script)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a wordpress-generated page where I need some posts (in a specific category)
I (will) have a JApplet embedded in a Wordpress.org installation (either on a page
I have a wordpress installation with some plugins and a custom theme. On one
I have a WordPress installation on my site, and I want to display WP
I have wordpress a site with a customized login page, the problem is when
I have a wordpress theme that I like to duplicate. To make things easier
I have configured WordPress to display a static front page as described here: http://codex.wordpress.org/Settings_Reading_SubPanel#Reading_Settings
I have a Wordpress theme that uses MooTools and jQuery. I use jQuery noConflict
I have a fairly complex WordPress + bbPress installation and I would like to
I have a PHP script located in my Wordpress installation's root folder wordpress-root/includes/login.php When

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.