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

The Archive Base Latest Questions

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

Take mod_rewrite for Apache server. I don’t fully understand why do I need both

  • 0

Take mod_rewrite for Apache server.
I don’t fully understand why do I need both RewriteRules in this sample:

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule ^$ public/ [L]
    RewriteRule (.*) public/$1 [L]
</IfModule>

Originally found at this DIY MVC tutorial, it seems like ^$ and (.*) mean the same thing. And why do I need two [L]ast flags since the second is not supposed to fire, right?
I’m trying to deeper understand all the internal mechanics instead of just copying the working solution.

  • 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-27T16:13:26+00:00Added an answer on May 27, 2026 at 4:13 pm

    No, ^$ and .* don’t mean the same thing: the first matches only an empty input, the second will match anything — including an empty input. The second rule should be enough.

    As to why there is [L] here, consider an empty request, and no [L]:

    • the first rule will turn the request into public/;
    • the second one will then trigger, and turn public/ into public/public/.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

please take a look at my .htaccess: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On
I am using Apache 2.2 and mod_rewrite. I would like to take the following
I have mod_rewrite take this url: mydomain.com/directory/index.php?slug=slug&year=2009 and make it pretty: mydomain.com/directory/slug/2009/ Easy, but
I am using WordPress's permalink structure %category%/%postname%/ with the following htaccess: <IfModule mod_rewrite.c> RewriteEngine
I looked at this topic: configuring search engine friendly url (mod_rewrite) and understand how
Take this code: <?php if (isset($_POST['action']) && !empty($_POST['action'])) { $action = $_POST['action']; } if
Take this non-compiling code for instance: public string GetPath(string basefolder, string[] extraFolders) { string
Our Linux server with Apache 2.x, Plesk 8.x hosts a number of e-commerce websites.
Is it possible to have Apache htaccess rewrites take effect before it hits django?
I need to put an URL (something along the lines of mysite.com/this/is/my/url) into an

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.