Chcę wczytać profile użytkowinków w formie http://adres.pl/profile/xxx
Niby wszystko działa, rzeczywiście wczytuje mi te profile ze slashem i bez na końcu ale jak pobieram dane o danym userze i jest slash na końcu wyskakuje mi że konto nie istnieje, a bez slasha jest ok.
.htaccess:
Kod
RewriteRule ^profile/(.+)/?$ ./profile.php?go=$1
Wyświetlanie profilu:
<?php try { $pdo = new PDO('mysql:host=localhost;dbname=xxx', 'xxx', 'xxx',array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8")); $pdo -> setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $query = $pdo -> prepare('SELECT * FROM users WHERE login = :login LIMIT 1'); $query -> bindValue(':login', $_GET['go'], PDO::PARAM_STR); $query -> execute(); $row = $query -> fetch(PDO::FETCH_ASSOC); $query -> closeCursor(); if($row==true) { $smarty->assign('user_data', $row); $smarty->display('profile.tpl'); } else { $smarty->assign('style','error'); $smarty->assign('message_title','Profil nie istnieje!'); $smarty->assign('message_text','Podany profil nie istnieje. Prosimy upewnić się, że dobrze wpisałeś/aś adres profilu.'); $smarty->assign('message_back','../index.html'); $smarty->display('message.tpl'); } } catch(PDOException $e) { } ?>
Jak zrobić by profil wyświetlało i ze slashem i bez na końcu?