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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:34:08+00:00 2026-06-09T15:34:08+00:00

I have public and private projects on my webserver. I put everything what is

  • 0

I have public and private projects on my webserver. I put everything what is public into the webserver root, and I have a private folder there which I can only reach from local network (set by .htaccess in there).

I want to simply put every private projects in the private folder and handle the requests automatically, but want the URLs look like they are served from webroot.
For example if there is private/project1 I want to use the URL http://example.com/project1 to serve that folder and don’t want to change the URL.

This simple rewrite:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ private/$1           

works, but when I have a private/project2 with another .htaccess:

Options +FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /project2/

<Files .*>
       Order Deny,Allow
       Deny From All
</Files>

# Allow asset folders through
RewriteRule ^(assets/.+) - [L]

# Protect files from being viewed
RewriteRule ^(uploads.+) - [F,L]


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

RewriteRule ^(.*)$ index.php/$1 [L]

</IfModule>
Options -Indexes

then the static content will appear, but the links are broken.
What should I modify to work ?

Also if I have a private/project3 and browse to http://example.com/project3/ there is no problem, but when I browse to http://example.com/project3 (without the trailing /) the URL will be visible as http://example.com/private/project3/ in the browser. Why ? How can I avoid that ?

  • 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-09T15:34:09+00:00Added an answer on June 9, 2026 at 3:34 pm

    All you need in your case is mod_alias.

    Then serve your private project like:

    Alias /project3 /apache/htdocs/private/project3
    

    And with .htaccess you will control access rights.

    If you want to control it without restarting server, you can try to achieve this with following config, that can be placed in .htaccess file:

    RewriteRule ^/(project1)$ /private/$1/index.html
    RewriteRule ^/(project1/)(.*)$ /private/$1$2
    

    index.html – any index file for your project.
    This way public part of URL’s will be completly accessible, beside path’s you are using for the private projects.
    You also can add RewriteCond to check IP and enable rewriting only for your local network.

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

Sidebar

Related Questions

I have a public/private key pair set up so I can ssh to a
I have class which have one public method Start , one private method and
I have public and private keys in separate .pem files that I would need
Let's say I have: public class Components<T> extends TupleList<Class<T>, String> { private static final
I have following class public class ButtonChange { private int _buttonState; public void SetButtonState(int
I have written a sample application to write to a public and private queues
I have a public desktop site, a public mobile site, and a private intranet
I have the following beans: public class CodedEntity { private String name; private String
Have a look at following scenario: public class ParentClass { private Integer testVar =
I have a MongoService class public class MongoService { private final Mongo mongo; private

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.