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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:26:58+00:00 2026-06-12T16:26:58+00:00

What I want to do is if I got duplicate name routes,I just use

  • 0

What I want to do is if I got duplicate name routes,I just use one route instead using 3 routes, but I not sure what regular expression I need to use, any suggestion?

now I have this

product_test_1.html
product_test_2.html
product_test_3.html

my codeigniter routes

$route['product_test_1.html'] = "website/product";
$route['product_test_2.html'] = "website/product";
$route['product_test_3.html'] = "website/product";

something what I want (but its not working)

$route['/product_test/i'] = "website/product";

Any idea solve my problem ?
thanks

  • 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-12T16:26:59+00:00Added an answer on June 12, 2026 at 4:26 pm

    Try this:

    $route['product_test_[0-9]+\.html'] = 'website/product';
    

    This is about specific as you can get. The [0-9] means any numerical digit (could also be \d) and the + means 1 or more of the preceding token (the numerical digit).

    If you want to capture just anything, the . token is “any character”, so you can replace [0-9]+ with .+, which means it will match a string of (pretty much) any character that is 1 or longer.

    This creates duplicate urls for the same page, which isn’t normally desirable, but maybe you specifically want that. If not, you may consider 301 redirects via .htaccess.

    You could also pass in the ID to the function with this if that is what you are going for.

    $route['product_test_([0-9]+)\.html'] = 'website/product/$1';
    

    The parenthesis captures the number and we pass it to the URL with $1 since it was the first capturing match captured.

    Then, in you website controller, you could declare your product method as such:

    function product($id)
    

    And $id will automagically be the ID we passed in the URL taken from the product_test_#.html

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

Sidebar

Related Questions

Ive got a div that i want to slide out on click using .show(slide,
I got a WPF application and I want to download a file. I'm using
I got an XML file that's using very generic XML tag names but a
Possible Duplicate: Change repo name in github I got some github repos that i
I have got two cfquery result with same column name. I want to merge
Just got a question about codeigniters routing when you only want the first segment
I got following repeating syntax and I want to keep all <h1> that is
I got an XML input string and want to deserialize it to an object
I got a Wikipedia article and I want to fetch the first z lines
I got 3 textviews which i want to move on swipe. How do i

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.