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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:45:17+00:00 2026-05-24T05:45:17+00:00

When coding a web application, should all files be linked through a single index.php

  • 0

When coding a web application, should all files be linked through a single index.php file.
Would doing such a thing help security, or would it make more complications later on.

How would you guys achieve this? Most (if no all) the site I have seen use this approach. Is there a reason for this?

Any help is greatly appreciated.

  • 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-24T05:45:18+00:00Added an answer on May 24, 2026 at 5:45 am

    Doing so doesn’t such much about security.

    The main advantage is that having every request go through index.php makes sure that you have a single entry point into your applications’s PHP code — which means you can put your initialization / configuration code there (or call it from there) and it’ll always get executed.

    On the how to achieve this, you’ll need :

    • A RewriteRule so all requests to non-existant files are sent to index.php
    • In your index.php script (or somewhere called by index.php, like a router), put some code to call the right controller/action.

    For the RewriteRule, here’s for example what is often done with Zend Framework :

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} -s [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^.*$ index.php [NC,L]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say you're coding some kind of web application. Something where people can contribute content,
I've been coding alot of web-stuff all my life, rails lately. And i can
I'm in early (pre-coding) stages of developing a mobile web application using jQuery Mobile
An older application using System.Web.Mail is throwing an exception on emails coming from hr@domain.com
When coding web services, how do you structure your return values? How do you
One of the things I like about coding old skool (web forms) is the
During hiring a .NET web developer I give the candidate a coding test. I
I'm coming from a web-development background and I am wondering how I would make
In coding a traditional MVC application, what is the best practice for coding server-side
I've been creating this pretty large web application for sometime and have been updating

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.