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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:43:25+00:00 2026-05-24T23:43:25+00:00

I got a component-based system that I’m trying to do some routing for using

  • 0

I got a component-based system that I’m trying to do some routing for using mod_rewrite. For some reason, I can’t get the syntax 100% right for all cases to work properly. The following are the four test cases (I can only get the last one to work):

/component/action/24_char_id  should be rewritten as /index.php?c=component&a=action&id=24_char_id
/component/24_char_id  should be rewritten as /index.php?c=component&id=24_char_id
/component/action should be rewritten as /index.php?c=component&a=action
/component should be rewritten as /index.php?c=component

These are the three rules I have so far:

RewriteRule ^([^/]+)/(.*)/([0-9a-z]{24})?/?$ /index.php?c=$1&a=$2&id=$3 [L,QSA]
RewriteRule ^([^/]+)([0-9a-z]{24})?/?$       /index.php?c=$1&id=$2      [L,QSA]
RewriteRule ^([^/]+)(?:/(.*))?/?$            /index.php?c=$1&a=$2       [L,QSA]

The URLs should be rewritten as specified above e.g. /index.php?c=$1&a=$2&id=$3, where “c” is the component, “a” is the action and “id” is the 24 character long id. Note that there are three variants of the URL in this scheme.

Any help would be appreciated — I’m stuck!

  • 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-24T23:43:26+00:00Added an answer on May 24, 2026 at 11:43 pm

    Got it figured out after some trial & error:

    RewriteRule ^([^/]+)/?([0-9a-z]{24})?/?$ /index.php?c=$1&id=$2 [L,QSA]
    RewriteRule ^([^/]+)/([a-z]+)/?([0-9a-z]{24})?/?$ /index.php?c=$1&a=$2&id=$3 [L,QSA]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got some code that uses the Component Categories manager to load all of
I've got a custom component that has children components dynamically added and removed to
Got a problem with ComponentListener. I'm using it to check if a certain component
In many tutorial of Acl component in cakephp i got instruction that add component
I have just installed Delphi 2010 and got some troubles with idHTTP component. If
I've got a webpage that validates as XHTML 1.0 Strict. I'm using YUI3 and
I'm trying to setup a Spring 3 Web MVC project, using the @Controller, annotation-based
I've got a custom component based on a TitleWindow. I want to put an
I've got an Excel spreadsheet that uses a C# Component. The component is an
I have been thinking of trying out component based architecture for game development. 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.