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

The Archive Base Latest Questions

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

I have a site with multiple languages. For my news page I have two

  • 0

I have a site with multiple languages. For my news page I have two rules to route the pagination variable to my controller. One for all the languages (en, ct, cs, kr), and one for the default language.

Routes.php

$route['^(en|ct|cs|kr)/news/page/(:num)'] = 'news/index/$1';
$route['news/page/(:num)'] = 'news/index/$1';

News controller

public function index($id) 
{
   echo $id; 
}

The routes are accessing the news controller, however the $id parameter isn’t being passed to the index() method.

If I echo the $id it returns the language segment rather than the pagination variable I am expecting:

mysite.com/en/news/page/2 // $id returns ‘en’.
mysite.com/kr/news/page/2 // $id returns ‘kr’.

It works when I write the routes out individually for each language:

$route[‘en/news/page/(:num)’] = ‘news/index/$1’;

Am I going wrong somewhere with my regex?

  • 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-12T07:58:44+00:00Added an answer on June 12, 2026 at 7:58 am

    That’s because in your first rule, you’re capturing 2 segments of the URL. The first one is the language (e.g. en), and the second one is the id (or page number). So, in your first rule you should instead use $2 instead of $1.

    $route['^(en|ct|cs|kr)/news/page/(:num)'] = 'news/index/$2';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a site that has all its content translated to multiple languages and
I have a site in multiple languages. I have a method that returns me
I have a site with multiple pages, and each page has a table that
I have created a site with multiple languages in sitecore... I the content editor
Alright im doing a site which is available in multiple languages. I have ran
I'm developing a web site / web app which supports multiple languages. I have
Let's say I have a site with multiple links as follows: www.example.com/product/1 www.example.com/product/2 www.example.com/product/3
I have multiple Projects(site) in my Solution (visual studio 2010). when i run my
I have a problem with my site. The site has multiple entities: Articles, Posts,
I have a web site (ASP.NET, no MVC) with multiple web forms for filling

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.