简体   繁体   English

URL重新写入影响页面内容

[英]URL ReWrite Affecting Page Content

I have a website with the following folder structure: 我有一个具有以下文件夹结构的网站:

website >> magazine >> news

Inside news my files include: 内部news我的文件包括:

htaccess, updates.php, articles.php & article.php

So my htaccess looks like: 所以我的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]

The problem(s) that I have is that when I visit website.uk/magazine/news/updates/1459967836 it shows the result for my article with ID 1460544406 . 我遇到的问题是,当我访问website.uk/magazine/news/updates/1459967836它显示了ID为1460544406文章的结果。

The code in my updates page is: 我的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";
...

Does anyone know why when I visit 1459967836 I gewt shown the result for 1460544406 . 没有人知道为什么当我访问1459967836我gewt所示的结果为1460544406

Also, when I visit website.uk/magazine/news/article-add-form.php I get shown website.uk/magazine/news/articles , even though the URL is displayed correctly. 另外,当我访问website.uk/magazine/news/article-add-form.php时,即使URL显示正确,我也会看到website.uk/magazine/news/articles Any Ideas? 有任何想法吗?

** SOLVED ** ** 解决了 **

By removing ( 通过删除 (

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

) the pages now show everything correctly! )页面现在可以正确显示所有内容!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM