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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T11:00:07+00:00 2026-06-10T11:00:07+00:00

What I want: Protecting all files/folders but the index.php. Apache: Apache/2.4.2 (Win32) OpenSSL/1.0.1c PHP/5.4.4

  • 0

What I want:

Protecting all files/folders but the index.php.

Apache:

  • Apache/2.4.2 (Win32) OpenSSL/1.0.1c PHP/5.4.4
  • Running as Service (xampp 1.8)
  • Not modified

My project structure

URL: “http://localhost/MyProject/”
PROJECT_DIRECTORY C:/xampp/htdocs/MyProject/

The project directory looks like:

  • config (folder)
  • ressources (folder)
  • sources (folder)
  • index.php

Problem:

I am having troubles with my .htaccess file as I do always receive a 403 or even a 500 Error.

I tried different settings to achieve the goal but none of these worked. I tried Directory, DirectoryMatch, Files, FilesMatch etc.

But I think it should be as easy as:

# Activate rewrite engine
RewriteEngine on
RewriteBase /

# Redirect all requests to index.php
RewriteRule ^(.*)$ index\.php?/$1 [QSA]

# Deny from all
Order deny,allow
Deny from all

# Allow only index.php
<Files "index.php">
Allow from all
</Files>

Or something like this:

...

# Deny from all
<Directory />
Order deny,allow
Deny from all
</Directory>

# Allow only root dir
<Directory "/MyProject" />
Allow from all
</Directory>


May someone can help me with this?

EDIT: I recently found out, that I cannot use the tag as the .htaccess is valid for the directory I put it in, so there is no need to define that directory inside .htaccess. This did not solve my problem but I know that the second example is wrong.

  • 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-10T11:00:09+00:00Added an answer on June 10, 2026 at 11:00 am

    You can try this:

    RewriteEngine On
    RewriteCond %{REQUEST_URI} !^/(index\.php)$
    RewriteRule ^ - [L,F]
    

    This will let requests for / and /index.php pass through while responding with a 403 Forbidden for anything else.

    However, you’ve got this rule already:

    # Redirect all requests to index.php
    RewriteRule ^(.*)$ index\.php?/$1 [QSA]
    

    So you don’t really need to deny anything if everything is already being routed through index.php

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

Sidebar

Related Questions

want to rewrite urls like site.com/software to wp-content/themes/dir/software.php and something is not working.. Here's
Want the function to sort the table by HP but if duplicate HPs then
I'm developing a website using php, i want to know how can i protect
Actually dont want people to decompress my Win32/PE executables. I found a solution from
i want to load a javascript in my C# web browser control. but VS
There is something I do not understand with locale management in Symfony2. I want
I have a PHP file i made that basically give me passwords to all
It feels like I'm abusing Stackoverflow with all my questions, but it's a Q&A
I am developing a small game with Java and all my files are bundled
I want to find the info about a webpage using curl, but in Python,

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.