Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #9807

Re: Using a single php entry file for a whole site.

From Jerry Stuckle <jstucklex@attglobal.net>
Newsgroups comp.lang.php
Subject Re: Using a single php entry file for a whole site.
Date 2013-06-20 13:48 -0400
Organization A noiseless patient Spider
Message-ID <kpvevu$o3b$1@dont-email.me> (permalink)
References <kpvdo8$dup$1@news.albasani.net>

Show all headers | View raw


On 6/20/2013 1:22 PM, The Natural Philosopher wrote:
>
> What I would like to do, is the following.
>
> ALL request to a site are redirected by apache rules to one single file.
> Let's call it index.php.
> Index.php notes the URL the user wants and looks it up in a database,
> and if it exists, includes()  the actual PHP file for that page.
> If it doesn't exist, a standard 'sorry, you are looking for a page that
> doesn't exist' is returned, if possible with the correct error code in
> the headers?
> The php files themselves apart from index.php do NOT live under the web
> root. They might in fact live in the database. But that's stage 2.
>
> Is this possible, and if so what if any are the downsides?
>

Sure, it's possible.  Many CMS's do it.  The advantage is you don't have 
to upload files.  Disadvantage is higher complexity of the code and more 
processing required for each page.  Additionally, maintenance and 
troubleshooting will be much harder, and unless you are *VERY CAREFUL* 
you can be adding security risks.  CMS's go to great lengths to avoid 
the security problems, but the troubleshooting and maintenance is still 
a problem.

> It seems to me that a user or robot level scrape of the site would not
> show anything of its true internal structure. But still show all the
> paths through it.
>

Internal structure is immaterial to the external world.  All they do is 
request a URI and get a response.

> What I want to do is have stuff like
>
> http:/mysite.com/news/Dog-Bites-Man
>
> redirect to say
>
> /var/private/newspage.php?id=3041
>
> where there exists a mysql table with a name value pair of
>
> news/Dog-Bites-Man: /var/private/newspage.php?id=3041
> or
> menu/Contact-the-webmaster: /var/private/contact.php?target=webmaster
>
> and so on.
>
> And possible a field for keywords to search the site with.
>

The question begs - why?  Unless you're trying to build your own CMS 
(but there are a lot of good free ones out there), I see no good reason 
for it.

But then I also consider the source of the question...

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Using a single php entry file for a whole site. The Natural Philosopher <tnp@invalid.invalid> - 2013-06-20 18:22 +0100
  Re: Using a single php entry file for a whole site. Jerry Stuckle <jstucklex@attglobal.net> - 2013-06-20 13:48 -0400
  Re: Using a single php entry file for a whole site. Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-06-20 10:48 -0700
    Re: Using a single php entry file for a whole site. The Natural Philosopher <tnp@invalid.invalid> - 2013-06-20 19:18 +0100
  Re: Using a single php entry file for a whole site. Stefan+Usenet@Froehlich.Priv.at (Stefan Froehlich) - 2013-06-20 18:23 +0000
    Re: Using a single php entry file for a whole site. The Natural Philosopher <tnp@invalid.invalid> - 2013-06-20 20:06 +0100
  Re: Using a single php entry file for a whole site. Marc van Lieshout <invalid@example.com> - 2013-06-20 21:29 +0200
    Re: Using a single php entry file for a whole site. Marc van Lieshout <invalid@example.com> - 2013-06-20 21:38 +0200
      Re: Using a single php entry file for a whole site. Jerry Stuckle <jstucklex@attglobal.net> - 2013-06-20 16:13 -0400
        Re: Using a single php entry file for a whole site. Marc van Lieshout <invalid@example.com> - 2013-06-21 00:33 +0200
          Re: Using a single php entry file for a whole site. Christoph Michael Becker <cmbecker69@arcor.de> - 2013-06-21 00:50 +0200
            Re: Using a single php entry file for a whole site. The Natural Philosopher <tnp@invalid.invalid> - 2013-06-21 07:45 +0100
              Re: Using a single php entry file for a whole site. Tim Streater <timstreater@greenbee.net> - 2013-06-21 10:08 +0100
                Re: Using a single php entry file for a whole site. The Natural Philosopher <tnp@invalid.invalid> - 2013-06-21 11:21 +0100
                Re: Using a single php entry file for a whole site. Christoph Michael Becker <cmbecker69@arcor.de> - 2013-07-15 01:15 +0200
          Re: Using a single php entry file for a whole site. Jerry Stuckle <jstucklex@attglobal.net> - 2013-06-20 19:35 -0400
    Re: Using a single php entry file for a whole site. Christoph Michael Becker <cmbecker69@arcor.de> - 2013-06-20 21:44 +0200
    Re: Using a single php entry file for a whole site. The Natural Philosopher <tnp@invalid.invalid> - 2013-06-20 22:38 +0100
      Re: Using a single php entry file for a whole site. Christoph Michael Becker <cmbecker69@arcor.de> - 2013-06-21 00:34 +0200
        Re: Using a single php entry file for a whole site. Jerry Stuckle <jstucklex@attglobal.net> - 2013-06-20 19:37 -0400
      Re: Using a single php entry file for a whole site. Marc van Lieshout <invalid@example.com> - 2013-06-21 00:51 +0200
        Re: Using a single php entry file for a whole site. The Natural Philosopher <tnp@invalid.invalid> - 2013-06-21 07:54 +0100
  Re: Using a single php entry file for a whole site. "Peter H. Coffin" <hellsop@ninehells.com> - 2013-06-20 14:54 -0500

csiph-web