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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T09:32:54+00:00 2026-05-21T09:32:54+00:00

I know this should be simple but I’m having a hard time writing the

  • 0

I know this should be simple but I’m having a hard time writing the .htaccess rule for my front controller.

The /themes/ folder contains all my css/js/images etc so I don’t want them to pass though my controller

The .htaccess file is in the root of the /myadminarea/ folder.

The root of the site (below ‘/myadminarea’ on ‘/’ has NO .htacess file)

Inside the front controller I look at the URL and then include the file directly – however I want to be quite forgiving with the Urls I accept..

If the url is for a specific file I want it to pass though the front controller

If the url is for a directory (trailing forward slash) I want to assume they are looking for index.php within that folder

The below rule works for urls like this

mydomain.com/myadminarea/mysection/action/ 
(loads mydomain.com/myadminarea/mysection/action/index.php via the front controller)

but falls over on urls like this –

mydomain.com/myadminarea/mysection/action/index.php

that contain a filename (it doesn’t use the front controller but just loads the file directly) – I know that the !-f excludes the rewrite rule for files, but I’ve tried every combination I can think of and the below at least works for urls without filenames. When I try to route EVERY request (except those to the themes folder) I get a server configuration error (500)

This is my rule

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule !^(themes)/ /myadminarea/index.php [NC,L]

edit:

Added Condensed front controller

// what page is actually being requested?
$uri = explode("/", $_SERVER["REQUEST_URI"]);
//lose the first element and add index.php the last one if it is blank
array_shift($uri);
if (end($uri) == ''){
    array_pop($uri);
    $uri[] = 'index.php';
}

$page_requested = implode('/', $uri);
if ($page_requested == 'myadminarea/index.php'){
    $page_requested = false;
}

includePage($page_requested);

function includePage($page_requested){
    if ($page_requested && file_exists(BASE_FILE_PATH . $page_requested) && is_file(BASE_FILE_PATH . $page_requested)){
        include(BASE_FILE_PATH . $page_requested);
    } else {
        echo $page_requested;
    }
}
  • 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-21T09:32:55+00:00Added an answer on May 21, 2026 at 9:32 am

    The leading slash in my rewrite rule was killing me…

    RewriteRule !^themes/* myadminarea/index.php [L,QSA]
    

    NOT

    RewriteRule !^themes/* /myadminarea/index.php [L,QSA]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this should be really simple, but im having trouble getting this to
I know this should be a simple task but I'm having problems selecting a
I know this should be simple and I should know it but it's eluding
I know this should be fairly simple but I don't get it anyhow. I've
I know this should be real simple, but I have googled this problem and
I know this should be simple but can't figure it out. Here's the code.
I know this should be simple but I can't make it work. I have
I feel like I should know this, but I haven't been able to figure
I get the feeling this is probably something I should know but I can't
First, apologies,this should be simple but I've had too much coffee and cannot wrap

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.