httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Denis Gerasimov" <denis.gerasi...@vekos.ru>
Subject RE: [users@httpd] Rewriting all URLs to /index.php
Date Thu, 31 Mar 2005 14:07:29 GMT
> On Thu, Mar 31, 2005 at 10:45:35AM +0400, Denis Gerasimov wrote:
> 
> > > If I'm understand you correctly, something like this:
> > >
> > > RewriteEngine on
> > > RewriteMap unescape int:unescape
> > > RewriteRule ^/news/([^/]+)/([0-9]+)\.html$ \
> > >     /index.php?url=${unescape:/news/$1.html}&id=$2 [L,QSA]
> >
> [snip]
> >
> > The thing is that requested URL, say /demo/test1.html, is internally
> mapped
> > to appropriate file containing PHP class, php/demo/test1.class.php in
> that
> > case. However, I want to have user-friendly URLs like
> /news/details/123.html
> > that should be mapped to php/news/details.class.php, not
> > /news/details/123.class.php
> 
> Which is completely different than your last post. =)

Well, I just forgot to mention that directory php/ is _outside_ server's
document root... :-(

Processing of request is made in the following way:

1. index.php creates Application object and calls run() method of it to rum
the application:

$objApplication = Framework_Application::getInstance();
$objApplication->run();

2. Application takes url parameter and passes it to Dispatcher:

$objURL = $this->getContext()->getURL();
return $this->getDispatcher()->dispatch($objURL);

3. Dispatcher finds and loads appropriate PHP class, located outside the
document root, creates Page instance and calls process() method:

include_once($strFile);
$objPage = new $strClass($this->getApplication());
return $objPage->process() && $objPage->display();

Now you know all the background :-)

> 
> So, something like this:
> 
> RewriteEngine on
> #
> # place 'news' in $1, 'details' in $2, and the name of the file in $3
> RewriteRule ^/([^/]+)/([^/]+)/(.*)\.html /php/$1/$2.class.php?id=$3
> [L,QSA]

No, that is still not a solution :-(

> 
> The assumption here is that the incoming URLs will be in the form:
> 
> /dir/dir/file.html
> 
> If your URLs can be in other formats, other regexes can be developed to
> handle those cases; you may need multiple RewriteRule lines to handle
> them, depending on how your layout.
> 
> --n
> 
> --
> <huey> dd of=/dev/fd0 if=/dev/flippy bs=1024
> <huey> ^^^ Making Flippy Floppy
> 
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message