The discussions here are for Phraw, a micro framework for the PHP programming language.
You are not logged in.
Pages: 1
I did a test on Ubuntu Server 11.10 + Nginx 1.0.5 + PHP 5.3.6 with spawn-
fcgi.
Phraw (dev) runs well.
Make sure to add these lines to the Nginx configuration of your web site:
location / {
# ...
if (!-f $request_filename) {
rewrite ^.*$ /index.php last;
break;
}
if (!-d $request_filename) {
rewrite ^.*$ /index.php last;
break;
}
# ...
}
Offline
I tried this and the initial home page showed up but the routes and 404 pages are not working.
Offline
My stack is Ubuntu/Nginx (1.0.2)/PHP5-FPM And I tried other micro frameworks without any issues like silex and slim php framework.
if ($phraw->detect_no_trailing_slash()) { # This fix the trailing slash
$phraw->fix_trailing_slash();
} else if ($phraw->route('')) { # Example of dynamic page
require('./resources/views.php');
home($phraw, $raintpl);
} else if ($phraw->bulk_route($static_pages, $page)) { # Example of static pages in bulk
$raintpl->draw($page);
} else { # The page does not exist: display error 404
$raintpl->display_error();
}
I tried both Phraw 0.3 and 0.4 with the same issue. Home page shows but other routes and 404 does not work.
Last edited by osb (2012-01-21 22:21:43)
Offline
Hi Osb,
I see that you are using the default regular expression algorithm for bulk_route(), so your $static_pages should be like (Phraw 0.4rc):
$static_pages = array(
'^$' => 'index.html',
'^about\/$' => 'about.html',
'^contacts\/$' => 'contacts.html',
'^documentation\/$' => 'documentation/index.html'
);
Is this?
If you don't want to use regular expressions, but very simple and plain URLs, just add the "equal" parameter to bulk_route():
...
} else if ($phraw->bulk_route($static_pages, $page, 'equal')) {
...
Offline
Pages: 1