php - .htaccess URL rewrite subfolder $_GET -
i trying create htaccess file website. got subfolders called admin. in subfolder index.php , content pages. want rewrite url's domain.com/admin/page1 example.
everything working main index files can't $_get['page']
working in admin folder.
url: http://techniekquiz.schl.nl/ http://techniekquiz.schl.nl/admin/ htaccess code:
rewriteengine on rewritebase / rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ ?page=$1 rewriterule ^admin/(.*)$ admin/index.php [nc,l] rewriterule ^(.*)admin/(.*)$ ?page=$1
my index.php (admin/index.php) file (only $_get
part of it)
$page = (isset($_get['page']) ? $_get['page'] : ''); if (!empty($page) && file_exists(''.$page.'.php')) { require (''.$_get['page'].'.php'); } elseif ( ( (!file_exists(''.$page.'.php')) or (!file_exists(''.$page.'.php')) ) && !empty($page)) { require('404.php'); } else { require('dashboard.php'); }
Comments
Post a Comment