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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:08:13+00:00 2026-05-20T18:08:13+00:00

Given that I know how to set the .htaccess… So my user instead of

  • 0

Given that I know how to set the .htaccess…

So my user instead of

http://www.pets.com/products.php?id=7

will see

http://www.pets.com/products/7/

But how to manage urls with no id numbers like

http://www.pets.com/products/dog-food-purina 

How can I write a general * rule to do that? Is it possible?
I thought I could write a php script that appends in the htaccess the rules one by one, one for each link, but it seems crazy right?

Something like

   #RewriteRule ^dog-food-purina/$  product.php?id=1 [NC,L]  
   #RewriteRule ^dog-food-otherbrand/$  product.php?id=2 [NC,L]  
   ...etc... 
  • 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-20T18:08:13+00:00Added an answer on May 20, 2026 at 6:08 pm

    Why not make an additional unique identifier in your database, so that a row of data has both a unique ID (7) and a unique “slug” (dog-food-purina)? That way you can look up rows any way you want by simply forwarding either the slug or the ID to your PHP script and handling it all there.

    For example: your purina row can be as follows:
    row -> id = 1
    row -> name = "Purina Dog Food"
    row -> description = "This is awesome stuff!"
    row -> slug = "dog-food-purina"
    row -> quantity = "10lbs"
    row -> price = "5"
    

    And then do something like this:

    if (is_string($param) && !empty($param)) {
        $sql = "SELECT * FROM products WHERE slug = '{$param}'"
    } else if (is_numeric($param) && $param > 0) {
        $sql = "SELECT * FROM products WHERE id = {$param}"
    } else return false
    

    Hope it helps

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

Sidebar

Related Questions

If I am given a MemoryStream that I know has been populated with a
Given that indexing is so important as your data set increases in size, can
Given that you have a method -(void)aSelector:(id)anyArgument; And have set up a UIButton programmatically
I'm having trouble solving this problem: Create a function that given a character set
I have a supervised learning problem where my algorithm will be given a set
Given that Chrome and Safari use webkit has anyone yet found anything that renders
Given that a function a_method has been defined like def a_method(arg1, arg2): pass Starting
Given that I only have one monitor, what's the best way to debug a
Given that Decimal.MaxValue = 79228162514264337593543950335m Why does the next line give me 7922816251426433759354395034M in
Given that: SSD’s are now [high end] mainstream Two+ cores are not hard to

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.