我的网站具有以下文件夹结构:
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
时的原因我gewt显示1460544406
的结果。
此外,当我访问website.uk/magazine/news/article-add-form.php
时,即使网址显示正确,我也会看到website.uk/magazine/news/articles
。任何想法?
答案 0 :(得分:0)
**已解决**
删除(
RewriteRule ^updates updates.php
RewriteRule ^articles articles.php
)页面现在可以正确显示所有内容!