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

  • Home
  • SEARCH
  • 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 9172007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:14:33+00:00 2026-06-17T16:14:33+00:00

I seem to be having trouble applying any examples I’ve found for stripping query

  • 0

I seem to be having trouble applying any examples I’ve found for stripping query strings.

We have a WordPress installation at http://www.example.com/blog/ , and for some reason, even though our categories are set to pretty slugs (IE http://www.example.com/categories/cat-name/ ), and even though I can never find any of the links on the reported referrer pages, Google webmaster tools keeps trying and failing to index http://www.example.com/blog/?cat=3, ?cat=25, ?cat=37, etc. In fact, right now it’s showing a little over 50 such URLs up to category #81, however we only have 11 categories.

The correct category URLs are indexed, and I’d like to just strip all of those query strings, and redirect to http://www.example.com/blog/, but none of the examples seem to work… here’s my latest attempt (in the webspace root… attempts in /blog/.htaccess have been fruitless as well):

RewriteEngine On

RewriteCond %{HTTP_HOST} ^example\.com [OR]
RewriteCond %{REQUEST_URI} /index\.html$
RewriteRule (.*?)(index\.html)?$ http://www.example.com/$1 [NE,R=301,L]

RewriteCond %{REQUEST_URI} \.jpg.+$
RewriteRule ^(.*\.jpg).*$ http://www.example.com/$1 [NE,R=301,L]

RewriteCond %{QUERY_STRING} ^cat=([0-9]*)$
RewriteRule ^(.*)$ http://www.example.com/blog/ [R=301,L]

Thanks in advance. Note the first group of rules enforces “www.”, and no “index.html”, and the second group drops everything after “.jpg”, as we had an odd issue with Google trying to index urls that ended in wierd ways, like “.jpg%20>”, as if it somehow missed the closing quotes of an anchor’s source, but I never could find such errors in the site… referrer was always a 300 error page.

  • 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-06-17T16:14:35+00:00Added an answer on June 17, 2026 at 4:14 pm

    If you want to completely strip off a query string, end your replacement string with a ?.

    From the Apache Rewrite docs:

    By default, the query string is passed through unchanged. You can, however, create URLs in the substitution string containing a query string part. Simply use a question mark inside the substitution string to indicate that the following text should be re-injected into the query string. When you want to erase an existing query string, end the substitution string with just a question mark. To combine new and old query strings, use the [QSA] flag.

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

Sidebar

Related Questions

I'm having trouble getting an INSERT query to execute properly, and I can't seem
I seem to be having some trouble with 100% widths. I have 3 divs,
I am having trouble figuring one of several error messages that seem to have
I seem to be having trouble with this. I have a Task table with
I seem to be having trouble splitting a namespace across projects. I have a
I have started looking into Backbone.js and I seem to be having trouble figuring
I seem to be having trouble with my code. I need to say: if
This may be something common and trivial, but I seem to be having trouble
I'm having trouble with MySQL or Python and can't seem to isolate the problem.
I'm having trouble trying to manipulate music using buttons I can't seem to make

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.