ディレクトリ: - project1に
- のProject2
- eventfinderがローカルホスト
URLパラメータとPHPクエリーリライト
- プロジェクトフォルダであるeventfinder
--- .htaccessファイル
ユーザーが来る電子ページhttp://localhost/eventfinder/とタイプ 'randomevent123' データベース
から/ eventfinder/
その後、PHPクエリはとどうなりますか?イベント= randomevent123
$event = $_GET['event'];
$stmt = $conn->prepare("SELECT * FROM events WHERE name = :name");
$stmt->bindParam(":name", $event);
$stmt->execute();
とリターンのデータの後に私は私のURLが、私の書き換えをしようとしています...問題が何であるかを
へhttp://localhost/eventfinder/index.php?event=randomevent123
を理解していません.htaccessの
RewriteEngine On
RewriteRule ^([^/]*)$ /index.php?event=$1 [L]
しかし、クエリで
http://localhost/eventfinder/randomevent123
は動作しません。
'RewriteRule^eventfinder /([^ /] +)/?$ /index.php?event=$1 [L]'あなたは現在/ eventfinder/'を考慮していません。 – CD001
@ CD001あなたが提案したものを変更しても何も起こらなかった – Troutfisher
'RewriteEngine On RewriteRule^eventfinder /([^ /] *)$ /eventfinder/index.php?event=$1 [L]' –