私の元のURLは/localhost/site/en/detail.php?id=1 &でしたtitle = Hello%20World と私はきれいなURL:/ localhost/site/EN /ポスト/ 1 /ハロー・ワールドが、問題は、オブジェクトが リライトURL:オブジェクトが見つかりません(.htaccess)
HTMLからの要求
を発見していないことである<a href="post/'.$rij['id'].'/'.$rij['title'].'"><div class="material"><i class="fa fa-1x fa-chevron-right"></i></div></a>
PHPファイルとPHPのハンドラ:
$titlestring = mysqli_real_escape_string($db, $_GET['title']);
$idstring = mysqli_real_escape_string($db, $_GET['id']);
$query = "SELECT * FROM posts WHERE id=".$idstring;
I BINDを行う変数の後に
そして、この私のhtaccessfileある
RewriteEngine on
RewriteBase/
#external redirect from actual URL to pretty one (remove query string)
RewriteCond %{THE_REQUEST} \s/+detail\.php\?id=$1&?title=([^\s&]+)
RewriteRule^%1? [R=302,L,NE]
# convert all space (%20) to hyphen
RewriteRule "^(\S*) +(\S* .*)$" $1-$2 [N,NE]
RewriteRule "^(\S*) (\S*)$" $1-$2 [L,R=302,NE]
# rewrite rule to call actual PHP handler
RewriteRule ^post/([0-9]+)/([-a-zA-Z_-]+) detail.php?id=$1&title=$2 [L,QSA,NC]
:しかし、あなただけ
かのようなもののいずれかにそれを変更する必要がありますが
ような何かをやっているのは、ふりをしましょう。私は私のコードをupdate'dし、私は本当に私のクエリでタイトルを使用していない、 –