2016-04-14 85 views
0

我有以下文件夹结构的网站:URL重写影响页面内容

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时,即使URL显示正确,我也会看到website.uk/magazine/news/articles。有任何想法吗?

回答

0

** **解决

通过移除(

RewriteRule ^updates      updates.php 
RewriteRule ^articles      articles.php 

)的页面现在可以正确地显示一切!