The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Hiding php extension
#6
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.
  Reply


Messages In This Thread
Hiding php extension - by MerajBD - 04-19-2019, 06:48 AM
RE: Hiding php extension - by mudmin - 04-19-2019, 11:50 AM
RE: Hiding php extension - by mudmin - 04-19-2019, 12:02 PM
RE: Hiding php extension - by MerajBD - 04-19-2019, 01:58 PM
RE: Hiding php extension - by mudmin - 04-19-2019, 02:07 PM
RE: Hiding php extension - by MerajBD - 04-19-2019, 03:16 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)