I created a new entry in the file .htaccess:
RewriteRule (. *). Php (. *) $ Index.php [NC, L]
Each request in a regular .php file is now processed by index.php from ZF.
:
$router->addRoute(
'legacy',
new Zend_Controller_Router_Route_Regex(
'(.+)\.php$',
array(
'module' => 'default',
'controller' => 'legacy',
'action' => 'index'
)
)
);
:
public function indexAction() {
$this->_helper->viewRenderer->setNoRender();
$this->_helper->layout->setLayout('full');
ob_start();
require($this->_request->get('DOCUMENT_ROOT') . $this->_request->getPathInfo());
$output = ob_get_contents();
ob_end_clean();
$doc = new DOMDocument();
@$doc->loadHTML($output);
$meta_elements = $doc->getElementsByTagName('meta');
foreach($meta_elements as $element) {
$name = $element->getAttribute('name');
if($name == 'keywords') {
$this->view->headMeta()->appendName('keywords', $element->getAttribute('content'));
}
elseif($name == 'description') {
$this->view->headMeta()->appendName('description', $element->getAttribute('content'));
}
}
$title_elements = $doc->getElementsByTagName('title');
foreach($title_elements as $element) {
$this->view->headTitle($element->textContent);
}
$element = $doc->getElementById('content');
$body = $doc->saveXML($element);
$response = $this->getResponse();
$response->setBody($body);
}
: http://www.chrisabernethy.com/zend-framework-legacy-scripts/