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 9011035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:37:16+00:00 2026-06-16T02:37:16+00:00

my query is about either creating a regex to capture: 0 or More Subcategories

  • 0

my query is about either creating a regex to capture:

  1. 0 or More Subcategories
  2. 0 or 1 Paging index
  3. 0 or 1 Product Id

This would be done easily by reading everything as a single parameter and this parameter passed to php, however it would imply tons of code and a performance hit whereas htaccess+regex will do this with a single line of code.

Example:

catalog/
Show all products starting from page 0

catalog/dolls/barbie/malibu/
display all malibu barbie dolls starting from page 0

catalog/dolls/gijoe/p_5/id_99
display product id_99. However the page and categories are maintained to be displayed as navigational links.

catalog/dolls/p_3
catalog/dolls/barbie/id_456

RewriteRule ^catalog/(([^/:*?"<>|\r\n]*/)*)(id-([0-9]{1,4}+))*$ catalog.php?category=$1&id=$3

Ive tried with a url like catalog/doll/barbie/id-1234/ like this; however capturing $1 would yield doll/barbie/id-1234/ and stuff like id-1234/id-345/id-145/ would be ‘valid’ returning 145 hence hurting seo placement with duplicate pages, this regex dont even deal with paging… I use RegexBuddy3 (very useful, a MUST buy) but apache+httacess don’t behave 100% the same when dealing with über long expressions.

  • 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-16T02:37:18+00:00Added an answer on June 16, 2026 at 2:37 am

    The easiest would be to pass the id of both the category and the product in the URL
    You can make the URL look like this
    catalog/dolls-12/ – You are now looking in the catalogue at the category id 12
    catalog/dolls/barbie/malibu-33/ – You are now looking in the catalogue at the category id 33
    catalog/dolls/barbie/malibu-33/barbie-450 – You are now looking in the catalogue at the category id 33 and at the product 450

    This should be all done with 3 rules in htaccess. If you receive a link that looks like
    catalogue/(.*)-number/(.*)-number you are looking at a product inside a category.
    catalogue/(.*)-number then you are looking at a category
    catalogue/ – you are looking at the entire catalogue.

    You do not need to capture everything, just the numbers, those will already tell you where you are.

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

Sidebar

Related Questions

How would I go about creating a query to replace a social security number
HI, I have this query about smart pointers. I heard from one of my
my query is about architecture and relation of classes, I would like to know
This query takes about 52 seconds to complete. It appears 82% of the time
How would I go about running a query in asp and storing it in
How would I go about doing a query that returns results of all rows
How would i go about creating a relationship for photo albums that belong to
I expected either index to be used for my SELECT DISTINCT query below: CREATE
This is the query I'm talking about: SELECT COUNT FROM Note N, DatePCC D
I know that there are some questions about this already, most relate to either

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.