私は検索しましたが、ここのすべての例は私のためには機能しません。Mod_rewriteルールを変更して記事タイトルをURLに追加します
I have a $_SESSION['title']; //Session variable contains title from calling page
$title = $_SESSION['title']; //local variable contains article title
のは、記事のタイトルを言ってみましょうは、ニュース・オブ・-日 私はそのような何かを試してみてください
http://www.newstoday.com/readnews/12/news-of-the-day
BTW http://www.newstoday.com/readnews/12 //this works
RewriteEngine on
RewriteRule ^readnews/([0-9]+)$ readnews.php?news_art_id=$1
これをHTML内のアンカーリンクで使用するにはどうすればよいですか? –
あなたのURLの両方 http://www.newstoday.com/readnews/12/news-of-the-day http://www.newstoday.com/readnews/12 readnews.phpスクリプトにリダイレクトされます。あなたは$ _GET ['news_art_id']と "news-of-the-day"(2番目の場合は "")から "12" を得ることができます。 php: $ id = 0からこのようなリンクが生成されました。 //これはあなたのIDだとしましょう $ title = $ _SESSION ['title']; $ link = 'http://www.newstoday.com/readnews/' $ id。 '/'。 $タイトル; –