我有我的网站,因为localhost/tutorials/rewrite/news.php
此页面上的标题来自我数据库中的新闻文章。每个标题都是阅读文章的链接。链接是
'<a href="read-news.php?url=' . $url . '">' . $title1. '</a>'
read-news.php 页面获取 url 并在 sql 语句中使用它从数据库中获取文章
$url = $_GET['url'];
$sql = "SELECT * FROM news WHERE url = '$url'";
我在 news.php 页面上的链接和 read-news.php 上的 url 看起来像这样
localhost/tutorials/rewrite/read-news.php?url=the-news-today
我怎样才能让它看起来像
localhost/tutorials/rewrite/read-news/the-news-today.php
我使用了以下 htaccess 代码,通过查看我认为应该足以修复它的其他示例
RewriteRule ^read-news/(.*).php /read-news.php?url=$1 [PT]
请提供任何帮助