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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T23:22:28+00:00 2026-05-19T23:22:28+00:00

I using htaccess mod_rewrite for a product site. when a product is going to

  • 0

I using htaccess mod_rewrite for a product site.

when a product is going to be add,

I create a hierarchy of product categories in url
like

1) http://www.example.com/Place-an-ad/Cars/Mazda/mazda-y/mazda-y-2/  4 levels here
2) http://www.example.com/Place-an-ad/Books/Science/                 2 levels here
3) http://www.example.com/Place-an-ad/Realestate/Apprtments/small/   3 levels here

categories can be 2, 3 or 4 level

I put this in htaccess, eventhough I do not want to duplicate.

RewriteRule ^Place-an-ad/(.*)/(.*)/(.*)/(.*)/(.*)/?$ new_ad.php?c1=$1&c2=$2&c3=$3&c4=$4 [NC,L] # for 4 level categories
RewriteRule ^Place-an-ad/(.*)/(.*)/(.*)/(.*)/?$ new_ad.php?c1=$1&c2=$2&c3=$3 [NC,L]  # for 3 level categories
RewriteRule ^Place-an-ad/(.*)/(.*)/(.*)/?$ new_ad.php?c1=$1&c2=$2 [NC,L] # for 2 level categories
RewriteRule ^Place-an-ad/(.*)/(.*)/?$ new_ad.php?c1=$1 [NC,L] # for 1 level category

Can any one short this, so that all categories can be handled by one rule.

  • 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-19T23:22:28+00:00Added an answer on May 19, 2026 at 11:22 pm

    It would be much easier to do this sort of url rewriting using whichever server side language (e.g. PHP) your site is written in. If you have these urls stored in a database you can add a table column to store the name of the script that should be executed when each url is called.

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

Sidebar

Related Questions

I'm using mod_rewrite to change all the URLs on a site. Example: http://www.site.com/about/ becomes
What RewriteRule (using .htaccess / mod_rewrite ) should I use to redirect http://example.com/blog/ (with
I would like to remove the query string from the URL using mod_rewrite (.htaccess),
I'm trying to implement a solution using .htaccess and wildcard subdomains so that http://subdomain.example.com
I want to rewrite URLs using .htaccess I want mod_rewrite to match ANY URL
I'm using http://github.com/lakshmivyas/hyde to generate my website, and it included .htaccess mod_rewrite rules, but
I'm using http://github.com/lakshmivyas/hyde to generate my website, and it included .htaccess mod_rewrite rules, but
I'm using http://github.com/lakshmivyas/hyde to generate my website, and it included .htaccess mod_rewrite rules, but
I'm redirecting this URL: http://mydomain.com/expandyourtaste Using this .htaccess file: #Expand your tastes redirects Redirect
I'm using .htaccess and mod_rewrite to point to files that reside behind the DocumentRoot.

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.