RE: [users@httpd] Rewriting all URLs to /index.php

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Noah,

I finally resolved this task a few days ago (at least it seems to be so :-))
Here is the solution:

<snip>
RewriteEngine on

RewriteLog "E:/intranet/wwwroot/rewrite.log"
RewriteLogLevel 2

RewriteRule ^(.*\/[^/.]+)$ $1/
RewriteRule ^(.*)\/$ $1/index.html [L,R]

RewriteRule ^/news/details/(\d+)\.html$ /news/details.html?id=$1 [QSA]
............

RewriteRule ^(.*\.html)$  /index.php?url=$1 [L,QSA]
</snip>

Anyway, I appreciate your help. Thank you!

> >
> > 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]
> 


---------------------------------------------------------------------
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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux