Path: csiph.com!usenet.pasdenom.info!gegeweb.org!eternal-september.org!feeder.eternal-september.org!mx05.eternal-september.org!.POSTED!not-for-mail From: "Peter H. Coffin" Newsgroups: comp.lang.php Subject: Re: Using a single php entry file for a whole site. Date: Thu, 20 Jun 2013 14:54:42 -0500 Organization: A noiseless patient Spider Lines: 45 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Injection-Info: mx05.eternal-september.org; posting-host="4163d0103afdb3d32fe6c98974b1e330"; logging-data="3395"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Bxc8UVxWMnsTKcm9XupFc" User-Agent: slrn/0.9.9p1 (OpenBSD) Cancel-Lock: sha1:bj2h7jraCp0IprvS9fV1NAtlcsg= Xref: csiph.com comp.lang.php:9820 On Thu, 20 Jun 2013 18:22:18 +0100, 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? > > 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. > > 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. You describe almost exactly how mediawiki works. Why not start looking at that to see how it does it? -- 14. The hero is not entitled to a last kiss, a last cigarette, or any other form of last request. --Peter Anspach's list of things to do as an Evil Overlord