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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T14:40:33+00:00 2026-05-10T14:40:33+00:00

In an application that heavily relies on .htaccess RewriteRules for its PrettyURLs (CakePHP in

  • 0

In an application that heavily relies on .htaccess RewriteRules for its PrettyURLs (CakePHP in my case), how do I correctly set up directives to exclude certain directories from this rewriting? That is:

/appRoot/.htaccess          app/          static/ 

By default, every request to /appRoot/* is being rewritten to be picked up by app/webroot/index.php, where it’s being analyzed and corresponding controller actions are being invoked. This is done by these directives in .htaccess:

RewriteBase /appRoot  RewriteRule ^$ app/webroot/     [L] RewriteRule (.*) app/webroot/$1 [L] 

I now want to exclude a few directories like static/ from this rewriting. I tried this before the Cake RewriteRules:

RewriteCond $1 ^(static|otherDir).*$ [NC] RewriteRule (.*) - [L] 

It works in so far that requests are no longer rewritten, but now all requests are being skipped, even legitimate Cake requests which should not match ^(static|otherDir).*$.

I tried several variations of these rules but can’t get it to work the way I want.

  • 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. 2026-05-10T14:40:33+00:00Added an answer on May 10, 2026 at 2:40 pm

    And the correct answer iiiiis…

    RewriteRule   ^(a|bunch|of|old|directories).* - [NC,L]  # all other requests will be forwarded to Cake RewriteRule   ^$   app/webroot/   [L] RewriteRule   (.*) app/webroot/$1 [L] 

    I still don’t get why the index.php file in the root directory was called initially even with these directives in place. It is now located in

    /appRoot/app/views/pages/home.ctp 

    and handled through Cake as well. With this in place now, I suppose this would have worked as well (slightly altered version of Mike’s suggestion, untested):

    RewriteCond $1      !^(a|bunch|of|old|directories).*$ [NC] RewriteRule ^(.*)$  app/webroot/$1 [L] 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to build a web application that heavily relies on the Yodlee
We have an existing application that relies heavily on stored procedures and untyped DataSets.
I am currently attempting to build a web application that relies quite heavily on
I have an application that relies heavily on charting and currently the charts will
I'm working on an enterprise application that relies heavily on message queues, com+, databases,
Similar to This Question , I have an application that relies heavily on in-process
I have inherited an ASP.NET 3.5 application that relies heavily on sessions and storing
I have an iPhone application that relies heavily on communicating with an external server.
We've been working on an application that quite heavily relies on VirtualPathProviders in ASP.NET.
I have an android application that relies heavily on Json Web Services. so 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.