Stack Overflow の誰かの助けを借りて、リンクを変更し、ユーザーと検索エンジンがより使いやすくなりました。この URLは この URLhttp://www.showcase.zz.mu/oferta.php?tip=Club&nume=Goblin&localitate=Bucuresti&judet=Bucuresti&id=52138700c4d7c
に変更されましたhttp://showcase.zz.mu/oferta/Club-Goblin-Bucuresti-Bucuresti-52138700c4d7c.php
。新しい URL に手動でアクセスしようとすると、正常に機能します。ただし、私の検索ページでは、生成されたリンクはまだ古いものであり、動的に生成されたページにアクセスするときに URL は同じままです。
これは私の .htacess コンテンツです:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteRule ^oferta/([^-]*)-([^-]*)-([^-]*)-([^-]*)-([^-]*)\.php$ /oferta.php?tip=$1&nume=$2&localitate=$3&judet=$4&id=$5 [NC,L,QSA]
これは、PHP でリンクを生成するコードです。
echo "<a href='oferta.php?tip={$result['tip_locatie']}&nume={$result['denumire_locatie']}&localitate={$result['localitate']}&judet={$result['judet']}&id={$result['id_oferta']}'><p style='margin-top: -5px;'>View page</p></a>";
$result が何であるか疑問に思っている場合:
$result = mysql_fetch_array( $resulta )
$resulta = mysql_query($query)
他に確認する必要がある場合は、お知らせください。また、質問を編集できるように、評価を下げる前にお知らせください。ありがとうございました!