Re: Large Project in PHP using 404 Error-Redirections.
| From: | Niklas Alberth | Date: | Tue, 17 Oct 2000 16:07:06 +0000 |
| Subject: | Re: Large Project in PHP using 404 Error-Redirections. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-20659@lists.php.net to get a copy of this message | ||
Starting in no perticular order.
1. yes it can be used in .htaccess
2. I think it's secure enough to use
3. say your url is /article/date/page1.html, Then you can have a rule looking like
RewriteRule ^/([a-zA-Z])/([0-9])/page([0-9]).html$ /index.php?page=$1&date=$2&page=$3
I'm not 100% certain that the rule will work but it's something like that, read the docs
at apache.org
--Niklas
----- Original Message -----
From: "Maxim Maletsky" <maxim@japaninc.net>
To: "'Matthias Endler'" <endler@upsys.de>
Cc: "'PHP General List. (E-mail)'" <php-general@lists.php.net>
Sent: Monday, October 16, 2000 5:25 AM
Subject: RE: [PHP] Large Project in PHP using 404 Error-Redirections.
Looks interesting, but what $1 is?
no one (nor even me ) knows what pages are existing,..
all is needed is to get the file name typed ( let's say
/articles/2000/10/16/features/writer.html ) and then with php the only way
to get the article is:
if( between first / and second / == articles(this is from db too) )
then parse and convert the next /x/x/x into the date, then in that
date search for the writer and whatever else.
then use whatever statements to base on when creating links from
that page etc...
my question is: if user types "/articles/2000/10/16/features/writer.html"
will this be assigned to $1?
can I catch with this every HTTP request? (guess ^(.*)$ means exactly
this...)
Do you know any cases that this method was used on any large project?
Is it secure enough?
Can this directive be defined from .htaccess file?
Cheers!
-----Original Message-----
From: Matthias Endler [mailto:endler@upsys.de]
Sent: Monday, October 16, 2000 12:02 PM
To: Maxim Maletsky
Cc: PHP-GENERAL
Subject: RE: [PHP] Large Project in PHP using 404 Error-Redirections.
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
> <http://www.japaninc.net/>
> http://www.lincmedia.co.jp
> <http://www.lincmedia.co.jp/>
>
>
>
>
>
--------------------------------------------------------------------------------
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net