Im using mod rewrite. But yes! on Google App Engine. The way they enable Mod Rewrite is in a file called mod_rewrite.php shown below. Currently Google App Engine's server only shows the index page and navigations do NOT work. I would like the whole app to be on that would be nice.
Im not that good with PHP syntax but Im trying to edit the if statement in this code to call all level scripts. for example also call application/profile or application/view/login instead of only /:
&& operator maybe
$path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
// Provide mod_rewrite like functionality. If a php file in the root directory
// is explicitly requested then load the file, otherwise load index.php and
// set get variable 'q' to $_SERVER['REQUEST_URI'].
if (dirname($path) == '/' && pathinfo($path, PATHINFO_EXTENSION) == 'php') {
$file = pathinfo($path, PATHINFO_BASENAME);
}
else {
$file = 'index.php';
// Provide mod_rewrite like functionality by using the path which excludes
// any other part of the request query (ie. ignores ?foo=bar).
$_GET['q'] = $path;
}
// Override the script name to simulate the behavior without mod_rewrite.php.
// Ensure that $_SERVER['SCRIPT_NAME'] always begins with a / to be consistent
// with HTTP request and the value that is normally provided.
$_SERVER['SCRIPT_NAME'] = '/' . $file;
require $file;
`
Aucun commentaire:
Enregistrer un commentaire