htaccessphp无法工作
我的.htaccess无法与GET一起使用。它显示“news/”,但一旦我转到“news/1”或“news/1/”它就不工作了htaccessphp无法工作,php,.htaccess,Php,.htaccess,我的.htaccess无法与GET一起使用。它显示“news/”,但一旦我转到“news/1”或“news/1/”它就不工作了 Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteRule ^/?$ index.php [NC,L] RewriteRule ^news/$ news.php RewriteRule ^news$ news.php RewriteRule ^news/([a-zA-Z0-9_-]
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^/?$ index.php [NC,L]
RewriteRule ^news/$ news.php
RewriteRule ^news$ news.php
RewriteRule ^news/([a-zA-Z0-9_-]+)/$ news.php?id=$1 [L,QSA]
RewriteRule ^news/([a-zA-Z0-9_-]+)$ news.php?id=$1 [L,QSA]
我的PHP是:
if(!isset($_GET["id"])){
$Article->printArticles();
}else{
$Article->printArticle($_GET["id"]);
}
但是它找不到$\u GET[“id”]
,但是在localhost上它可以工作。
已尝试使用[L,QSA]、[N]、[NC,L]和不使用任何这些
htaccess如何查找$\u GET[“id”]
htaccess如何查找$\u GET[“id”]
这很可能是web服务器上启用了多视图
选项的结果
使用顶部的此行将其关闭:
Options +FollowSymLinks -MultiViews
由Apache的内容协商模块使用,该模块在mod_rewrite
之前运行,并使Apache服务器匹配文件扩展名。因此,如果/news
是URL,那么Apache将提供/news.php