RE: [PHP] Large Project in PHP using 404 Error-Redirections.
| From: | Matthias Endler | Date: | Mon, 16 Oct 2000 03:01:36 +0000 |
| Subject: | RE: [PHP] Large Project in PHP using 404 Error-Redirections. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-20293@lists.php.net to get a copy of this message | ||
Why not use apache's mod_rewrite? This is a lot more elegant than your 404
approach.
if you use something like this in your httpd.conf:
RewriteEngine On
RewriteRule ^(.*)$ /index.php?page=$1 [PT]
So if somebody requests a url like this:
http://somehost.com/login
apache rewrites this internally to:
http://somehost.com/index.php?page=/login
and passes this to the php-handler, but the user will still see
http://somehost.com/login
Hope this helps
Matthias aka Matthew
--
$ [ Where is Jimmy Hoffa?
[: missing `]´
> -----Original Message-----
> From: Maxim Maletsky [mailto:maxim@japaninc.net]
> Sent: Monday, October 16, 2000 4:24 AM
> To: 'PHP General List. (E-mail)'
> Subject: [PHP] Large Project in PHP using 404 Error-Redirections.
>
>
> Hello List,
>
> Relying on all your great experience I am asking for an advice:
>
> Is it OK to provocate 404-error and so redirect users to a PHP template in
> order to create a _VERY_ large and portable website?
>
> Here's our project:
>
> It's a web-site. It HAS to be a Fully Database-Driven & "Sales-people"
> administered.
> It is crucial to have HTML, Databases and the Software Itself completely
> Independent from each other. It also must be easy to install and
> things like
> file managing, creating, uploading must have nothing to do with any FTP,
> Telnet, fopen functions. All the content has to be in the database while
> templates somewhere behind the root, plus one single file will
> ever exist to
> connect the "website" to the "software" which then will connect to the
> "database(s)".
>
> I thought to do it in this way: having some kind of "virtual web
> site" where
> only _one_ file (let's call it /index.php) exist and whatever
> else you would
> request would provocate a 404 error which (though httpd.conf or .htaccess)
> will redirect you to this file (/index.php). then /index.php
> would have one
> single include of config file followed by a very basic html design - only
> tables with site_header(), site_content(), and site_footer() functions in
> it.
>
> These three only functions are defined in config file. Then site_content()
> (can already be called as "software") will work this way: first
> with explode
> and regular expressions will parse the file name to know what
> database,table
> to connect itself to and what fields to select, then pull out the data,
> create virtual links, and so on...
>
> I think the idea should work.
>
> What all of you can advise to me, and most importantly what, if any, are
> disadvantages of using the 404 error to start the software. Will a
> browser/search engine/another non-authorized server know that the page
> requested is an error page even if it has the right content in it?
>
> If 404 is troublesome, how else can I redirect _any_ request to
> _one_single_file_ which will then output you the data basing on
> $SCRIPT_NAME
> and $REQUEST_URI pred. variables?
>
> (We cannot use any variable passing via get / post methods except in few
> cases)
>
> NOTE: that the site might become _VERY_ large, and that's the reason of
> having as dynamic and portable as posible (to be able to modify
> the design,
> content, database types, split it between servers, etc..)
>
> I appreciate your help, gurus!
> :-))
>
> Maxim Maletsky - maxim@j-door.com
> <mailto:maxim@j-door.com>
> Webmaster, J-Door.com / J@pan Inc.
> LINC Media, Inc.
> TEL: 03-3499-2175 x 1271
> FAX: 03-3499-3109
>
> http://www.j-door.com
> <http://www.j-door.com/>
> http://www.japaninc.net <¨¯Âw�É"”g8‡
> K�Uhttp://www.japaninc.net/>
> http://www.lincmedia.co.jp
> <http://www.lincmedia.co.jp/>
>
>
>
>
>