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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T19:08:18+00:00 2026-05-21T19:08:18+00:00

I am currently creating a CMS on a framework. I have made my .htaccess

  • 0

I am currently creating a CMS on a framework. I have made my .htaccess file, which looks like this:

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^([A-Za-z]+)/(.*)$ index.php?url=$1 [PT,L]

</IfModule>

My problem is, that:

1) My pages can be accessed with the normal MVC URL:
http://example.com/pages/view/{the-shorttag-of-the-page}

2) My pages is also accessible with a route:
http://example.com/p/{the-shorttag-of-the-page}

What I really need to implement is that I can access it in two ways:
http://example.com/{the-shorttag-of-the-page}
Or with language support
http://example.com/{lang}/{the-shorttag-of-the-page}

My problem is that I don’t want to change the mod_rewrite – I rather want to make the routes in PHP, but I can’t find a solution of how to route to the PageController->view() method without having a static letter (“p” in the upper example) in the conditions.

Do you understand my question?
And do you have some tips, that could lead me in the right direction?

  • 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-21T19:08:19+00:00Added an answer on May 21, 2026 at 7:08 pm

    This sounds like you need to implement some kind of router.

    I’ve faced it myself and this is how I made it work quite good:

    Some router class parses the URL. It explodes URL parts (/en/controller/action/param1/paramval1/) into pieces. It determines language code (default if not provided), controller, action, etc.
    Router also provides information (controller, action names, parameters) to other parts of the system, although you may implement special class for that purpose (eg. Request).

    Now different parts of the system have access to given information via Router or Request class. From here on, it should be easy to implement multilangual site.

    Once again, the important part is mapping URL to controller and action. Definitely, if you don’t want URL like /controller/action/parameter1, you should have some mapping table (XML document / database table) that maps a stub (page short tag) to controller and action. It is the router that reads this table and determines controller, action and other parameters based on the given rules.

    Hope I didn’t complicate too much 🙂

    Update:

    As for myself, I’ve implemented mapping with XML file. Let me explain further: router takes care of resolving the URL. Normally, your URL would contain the controller and action name (in your case, pages is the controller, view is the action).

    Now in your case, you want just a stub, so router must somehow obtain the information about which controller and action is being called. That is the purpose of mapping, to map the stub to appropriate controller and action.

    I’ve implemeted this as static routes, written manually into XML file, but you could for example use some kind of plugin class that checks if stub actually relates to a page. If it doesn’t, that can mean two things: it is a controller or request is invalid.

    Let me talk further about collisions: if stub is the same as the name of any controller, you have a collision. Should you render a page with a given stub, or call the controller? That has to resolved somehow, perhaps you can programatically restrict user to have a page with that kind of stubs.

    Also, next time you dive into application development with PHP, I’d recommend you using some well-known PHP framework (if you don’t already, ofc.), e.g. Zend, Kohana or CodeIgniter. They all provide router and many other components that make developing applications much easier, faster and more secure.

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

Sidebar

Related Questions

I'm currently creating an explicit reference to this in the outer class so that
I am currently creating an e-commerce site using C# ASP.NET MVC and have just
Currently I have the function CreateLog() for creating a a log4net Log with name
I am currently in the process of creating my own blog and I have
I'm currently creating an application for a customer that will allow them to automatically
I'm currently creating a WinForm in VB.NET bound to an access database. Basically what
I'm currently working on creating a new C# project that needs to interact with
We currently deploy web applications by creating a database and running SQL scripts through
I'm currently planning out a project involving creating a shell replacement for Windows (based
Is there a way in Cocoa that is currently considered best practice for creating

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.