我有一个网站,其文件夹结构如下:
website >> magazine >> news
在news
中,我的文件包括:
htaccess, updates.php, articles.php & article.php
所以我的htaccess
看起来像:
Options -MultiViews
DirectoryIndex updates.php
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^updates updates.php
RewriteRule ^articles articles.php
RewriteRule ^updates/(['w-]+)/?$ updates.php?id=$1 [NC,L,QSA]
RewriteRule ^articles/([0-9]+)/?$ articles.php?currentpage=$1 [NC,L,QSA]
RewriteRule ^article/([0-9]+)/(['w-]+)/?$ article.php?id=$1&title=$2 [NC,L,QSA]
我遇到的问题是,当我访问website.uk/magazine/news/updates/1459967836
时,它显示了ID为1460544406
的文章的结果。
我的updates
页面中的代码是:
...
if(isset($_GET["id"])){$id = $_GET["id"];}else{
$id = "latest";
}
?>
<?php
if ($id == "latest"){$var = "ORDER BY added DESC LIMIT 1";}else{$var = "WHERE id = '$id'";}
?>
<?php
$posts_sql = "SELECT * FROM magazine_news_updates $var";
...
有人知道为什么当我访问1459967836
时,我显示了1460544406
的结果吗。
此外,当我访问website.uk/magazine/news/article-add-form.php
时,我会看到website.uk/magazine/news/articles
,即使URL显示正确。有什么想法吗?
**已解决**
通过移除(
RewriteRule ^updates updates.php
RewriteRule ^articles articles.php
)页面现在可以正确显示所有内容!