Oh, I already have my htacces working,
Code:
DirectoryIndex index default
# hide php extension
RewriteEngine On
# filename > filename.php (transparent)
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^ %{REQUEST_URI}.php [ QSA,NC,L ]
Redirect.php class
Code:
class Redirect {
public static function to($location = null, $args=''){
global $us_url_root;
#die("Redirecting to $location<br />\n");
if ($location) {
if (!preg_match('/^https?:\/\//', $location) && !file_exists($location)) {
foreach (array($us_url_root, '../', 'users/', substr($us_url_root, 1), '../../', '/', '/users/') as $prefix) {
if (file_exists($prefix.$location)) {
$location = $prefix.$location;
$location = preg_replace('~/{2,}~', '/', $location);
break;
}
}
}
if ($args) $location .= $args; // allows 'login.php?err=Error+Message' or the like
if (!headers_sent()){
$location = str_replace('index.php','',$location);
$location = str_replace('.php','',$location);
header('Location: '.$location);
exit();
} else {
$location = str_replace('index.php','',$location);
$location = str_replace('.php','',$location);
echo '<script type="text/javascript">';
echo 'window.location.href="'.$location.'";';
echo '</script>';
echo '<noscript>';
echo '<meta http-equiv="refresh" content="0;url='.$location.'" />';
echo '</noscript>'; exit;
}
}
}
}
I get it worked. But i'd to edit some files manually like <form action="login.php"> to <form action="login">
I have a suggestion:
You can add a option in confi called "file extension for urls". As user define their preferred extension e.g.: php, html, (empty for no extension) and you can rewrite your files and replace somthing like
Code:
<a href="<?=$abs_us_root.$us_url_root.'users/account'.$file_ext.''?>">Account</a>
or
<form action="login<?=$file_ext?>">
I know it requires a hard work to rewrite all these scripts but I can assure that you don't have to do a hard work. Only few files which basically have <a> tags not require function need to be edited. You can do it and release in next release. I can be a tester or contributor if you want.