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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:09:01+00:00 2026-05-26T23:09:01+00:00

I am having an issue using the routes in Codeigniter and my expressions I

  • 0

I am having an issue using the routes in Codeigniter and my expressions

I have a URL like follows (for a offers page):

www.site.com/company/offers/view/newsarticle/219

and a route like follows:

$route['([a-z0-9_-]+)/offers/view/([a-z0-9]+)/([0-9]+)'] = "offers/view/$1/$2/$3";

I have the above route setup so if should go to the offers controller, and the view function and pass the 3 parameters (company, newsarticle, 219)

It works all fine however if the 4th uri segment contains and ‘-‘ it breaks and gives me a 404 page
eg

This works

www.site.com/company/offers/view/newsarticle/219

But this doesn’t

www.site.com/company/offers/view/news-article/219

Can anyone explain what I’ve done wrong with the expressions? 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-05-26T23:09:01+00:00Added an answer on May 26, 2026 at 11:09 pm

    Your expression doesn’t allow a hyphen character

    ([a-z0-9_-]+)/offers/view/([a-z0-9]+)/([0-9]+)
    

    Should be

    ([a-z0-9_-]+)/offers/view/([a-z0-9\-]+)/([0-9]+)
    

    Note the \- in the [a-z0-9\-]. The \ character escapes the hyphen to tell the expression engine that it’s not a range operator.

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

Sidebar

Related Questions

having an issue using a NSMutableArray; In my implementation file applicationDidFinishLaunching method I have
I’m having an issue using SqlBulkCopy when nullable columns are involved. It sounds like
I am having some issue here using LWP::Simple to get ftp site content in
I'm having an issue using crypt. I'm rebuilding a site for a client. So
I am having a issue using Google's SDC (Secure Data Connector) with my Google
I'm having an issue using the Cookie class of the Servlet API 2.5 on
I believe I am having a memory issue using numpy arrays. The following code
i'm having a little issue with doctrine using symfony 1.4 (I think it's using
I'm having an issue verifying if a checkbox is checked using jquery on Internet
I'm having an issue in IE 6 and 7 when using jqGrid (v3.6.4) and

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.