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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T01:46:52+00:00 2026-06-12T01:46:52+00:00

Consider the following: RewriteRule ^(.*)$ index.php/$1 Based on the fledgling noob knowledge I have

  • 0

Consider the following:

RewriteRule ^(.*)$ index.php/$1

Based on the fledgling noob knowledge I have of mod_rewrite, this should match the entire URL part between example.com/ and ?query=string, and then prepend it with index.php/, and generally, that’s exactly what happens.

http://example.com/some/stuff -> http://example.com/index.php/some/stuff

Now, consider:

RewriteRule . index.php

According to the developers of the current update to the Concrete5 CMS, this does the exact same thing. And indeed, it appears to do just that on my server as well.

My question is, why does the second RewriteRule yeild the same result instead of something like

http://example.com/some/stuff -> http://example.com/index.phpome/stuff

Shouldn’t the . match one character and then be replaced with the index.php string? This is on Apache 2.2.

  • 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-12T01:46:53+00:00Added an answer on June 12, 2026 at 1:46 am

    RewriteRule ^(.*)$ index.php/$1 will match and use the captured text to create a new path with whatever was originally requested added to the end where the $1 is.

    RewriteRule . index.php matches because it is an unanchored regex. The previous regex uses ^ and $ to anchor the match which means that the pattern must match entirely while this one does not which means that it will match anywhere in the string, so any string with any character will match. Because mod_rewrite treats each test as a running predicate, this rule will be applied as long as it matches.

    When the rule is matched the substitution takes place. The substitution is a complete substitution, so if you don’t use backreferences like $1 then whatever was in the original pattern is lost. In this case the new path just becomes index.php.

    There is therefore a slight difference between the 2, in that the second just goes directly to index.php without adding the originally requested path on to the end. Most likely Concrete5 CMS is using a front controller which dispatches according to information it pulls from the request directly. Since this isn’t a redirect rewrite, the original request will be perserved so that is just used instead: shifting some responsibility from Apache and into the hands of the application code, pursuing less dependence on the hosting environment.

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

Sidebar

Related Questions

Consider the following rules RewriteRule ^index\.html$ index.php [L] RewriteRule ^index\.php$ index.html [R=301] I want
consider following: 1st APPROACH: public void f3() { f2(); f1(); } and this ...
Consider following scenario: I have RESTful URL /articles that returns list of articles user
Consider following SWT code example: http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet151.java?view=co How can I separate the inline defined class?
Consider following two tables: tag_names (tag_id, tag_name) tag_links (tag_id, image_id) An image can have
Consider following assumptions: I have Java 5.0 Web Application for which I'm considering to
Based on: MVC Html.CheckBox and form submit issue Let's consider following example. View: <%
I have a question regarding exception handling. Consider following Java code snippet. try{ //code
Consider following case: I have base class inherited by another two. For instance we
Consider following code: Dim S1 As String = a 'this is the string in

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.