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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:56:35+00:00 2026-05-23T16:56:35+00:00

Background I’m looking for a transparent, PHP-driven authentication layer for a web site. I’m

  • 0

Background

I’m looking for a transparent, PHP-driven authentication layer for a web site.

I’m aware of the following simple approaches:

HTTP Authentication

Mechanics:

  • Apache controls access rights;
  • Attempts to access any file in a given directory transparently require HTTP auth if not already authed.

Downsides:

  • Limited configuration options;
  • Difficult to integrate with existing user database;
  • No control over visual presentation of login prompt.

PHP-based login

Mechanics:

  • PHP controls access rights;
  • Attempts to access any file explicitly built for the system if not already authed will result in redirection to a login page.

Downsides:

  • If I forget to write the required include "login_required.inc.php"; or similar at the top of any PHP file, that file will be accessible by anybody.

What I want

I’d like to implement the PHP-based login solution, but to somehow configure Apache to invoke login_required.inc.php (or similar) transparently as an intermediate step when any PHP file is requested.

This script will:

  • run;
  • check session variables;
  • tell Apache either “yes, produce the requested page” or “no, redirect to the login page”;
  • not require code to be inserted at the top of every PHP script that requires authentication.

Is this a pipe dream? Or can I do it? And if so, how?

  • 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-23T16:56:35+00:00Added an answer on May 23, 2026 at 4:56 pm

    If you rewrite all php requests through index.php, index.php/php would then control access to anything.

    RewriteRule ^(.*)$ /index.php?pageid=$1 [QSA,L]
    

    Something like that will push any request to index.php, in which you can do your authentication and then it will farm out the content…

    The QSA in this will retain any query string parameters etc.

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

Sidebar

Related Questions

Background Developing a simple web application (Eclipse + JBoss + Apache Tomcat) to generate
Background I am writing and using a very simple CGI-based (Perl) content management tool
Background I have a massive db for a SharePoint site collection. It is 130GB
Background : I currently have a Web Forms, ASP.NET 3.5/C# application which I'm interested
Background I have a web app that will create an image from user input.
background-position: -200px 0; one site says it crops an image from the bottom and
Background Looking to automate creating Domains in JasperServer. Domains are a view of data
Background I've got the following tree of objects: Name Project Users nil John nil
Background: On a recent website, I'm using a jQuery driven dropdown menu in addition
Background Use Ajax to fire an event to the web server when a list

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.