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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:27:11+00:00 2026-05-26T03:27:11+00:00

I would like to have these urls as categories on my page: http://example.com/en/articles //for

  • 0

I would like to have

these urls as categories on my page:

http://example.com/en/articles        //for list of all
http://example.com/en/articles/cars    //for list of all cars articles
http://example.com/en/articles/nature  //for list of all nature acrticles
http://example.com/en/articles/sport    //for list of all sport articles

I am using i18n that is why I have also another links like:

http://example.com/fr/articles        //for list of all
http://example.com/fr/articles/cars    //for list of all cars articles
http://example.com/fr/articles/nature  //for list of all nature acrticles
http://example.com/fr/articles/sport    //for list of all sport articles

This is easy, I call a controller articles.php anf inside it I have functions cars, nature, sport and everything works well.

However, I want to have articles, no matter what category they are, like this:

http://example.com/en/articles/article-about-cars
http://example.com/en/articles/article-about-nature

So, the category fell out from url when full article is view.

I am using i18n so my routes for this look like this:

$route[’^en/articles/(.+)$’] = “articles/show_full_article/$1”;
$route[’^fr/articles/(.+)$’] = “articles/show_full_article/$1”;

But this call everytime the function show_full_article, because it is in the 2nd segment.

So, I somehow need to rebuild the regex in:

$route[’^en/articles/(.+)$’] = “articles/show_full_article/$1”;

to exclude functions cars, nature and sport. I have only 3 categories so typing it manually is no big deal.

Please, if you know how to type the regex in routes.php to exclude these three categories , so codeigniter do not see them anymore as article names, let me know. I will appreciate it very much.

Thank you in advance for any advice.

  • 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-26T03:27:11+00:00Added an answer on May 26, 2026 at 3:27 am

    You probably want to use a negative lookahead (?!...) for that.
    In your case:

     $route['^en/articles/(?!(?:cars|nature|sport)$)(.+)$'] =
    

    This ensures that the (.+) can not be one of those words. It needs to be wrapped in (?:..)$ so it also matches the end of the string, as otherwise the assertion would also block natureSMTHNG and similar longer terms.

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

Sidebar

Related Questions

I'm working on a Rewriterule in order to have URLs like these: http://www.myhost.com/var1/var2/ RewriteRule
I have a list of URLs such as, http://www.mywebsite.com/page.php?genus=A_GENUS&species=A_SPECIES&id=12345 . I would like to
I have this .htaccess that I've been using to rewrite URLs like these: www.example.com/index.php?page=brand
I have an ecommerce site which currently has product URLs like this: http://www.mydomain.com/nike-tshirt/Large http://www.mydomain.com/nike-tshirt/Medium
I wanna get url path by javascript, for example, i have these urls: http://localhost:8080/blah/blah/index.php?p=1
I have two classes that I would like to merge into a composite. These
I have an array with 16 elements. I would like to evaluate these to
I have a class that implements multiple interfaces. I would like to register these
I have a program that generates/'rolls' two dice. I would like to output these
I currently have URLs which look like this: things?category_id=6&country_id=17 and I would like 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.