.htaccess - Hide php page name of header function in url -
i'm trying hide php page name in url redirects after login header function. far can hide index file can't hide file redirects after login. here codes,
php script after login events
$sql_login = mysql_query("select * sms_people username='$username' , password='$password'"); $row = mysql_fetch_array($sql_login); if ($row > 0 && $row[5] == 1) { header('location: adminpanel.php'); }
.htaccess
rewriteengine on rewritecond %{request_filename} !-d rewritecond %{request_filename}\.php -f rewriterule ^(.*)$ $1.php [l]
how can hide files redirects header function using .htaccess
file? need badly. tnx.
there alternative way redirect php files , hide them
for example http://yourwebsite.com/user/login/
user part main user.php or can change file name
firstl, in htaccess redirect index php
rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d ############### seo ########################## rewriterule ^(.*)$ index.php?url=$1 [qsa,l]
in index.php file
$rootfolder="parts" if(isset($_get["url"])){ $part= explode("/", $_get["url"]); if(isset($part[0])) $controller = ''.strtolower($part[0]).''; if(isset($parca[1])) $method = ''.strtolower($part[1]).''; if(isset($parca[2])) $id = ''.$part[2].''; if( file_exists($rootfolder."/".$controller.php)) { //you can call file if exits requre_once $rootfolder."/".$controller.php; }else{ die("404 not found !"); } }
Comments
Post a Comment