Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sql-server-2005/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mod rewrite 如何从mod_重写的url查询字符串中获取_Mod Rewrite_Get_Query String - Fatal编程技术网

Mod rewrite 如何从mod_重写的url查询字符串中获取

Mod rewrite 如何从mod_重写的url查询字符串中获取,mod-rewrite,get,query-string,Mod Rewrite,Get,Query String,我有一个liitle mod_重写问题 我在根目录中有index.php,其中包含简单的href链接: <a href="novice/this-is-something">Novice</a> 但它只输出0 但当我在href link中传递数字时,就像这样: if (isset($_GET['query'])){ $query=$_GET['query']; echo $query; }else{ echo 'Null parameters.';

我有一个liitle mod_重写问题

我在根目录中有index.php,其中包含简单的href链接:

<a href="novice/this-is-something">Novice</a>
但它只输出0

但当我在href link中传递数字时,就像这样:

    if (isset($_GET['query'])){
$query=$_GET['query'];

echo $query;
    }else{
echo 'Null parameters.';    
    }
    <a href="novice/2131">Novice</a>
    RewriteRule ^novice/([^/\.]+)/?$ novice.php?query=$1 [L]
所以,我在mod_rewrite中做错了什么,我可以通过$_get方法获得数字,但我不能通过$_get获得字符串或字符?

我自己找到了解决方案

我刚刚更改了RewriteRule ^Nearoor/[^/]+/?$Nearoor.php?query=$1[L]末尾的查询词

blabla word->重写规则^newiler/[^/]+/?$newiler.php?blabla=$1[L]

然后一切都开始运作。。。很奇怪

    if (isset($_GET['blabla'])){
    $blabla=$_GET['blabla'];

   echo $blabla;
}else{
 echo 'Null parameters.';    
}
它现在是参数,这是一些东西。。但还是不知道问题出在哪里。。我刚刚更改了包含参数this is something.的变量查询的名称

顺便说一句,如果有人感兴趣:my.htaccess如下所示:

    Options +FollowSymLinks
    RewriteEngine On

    # Unless directory, remove trailing slash
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^([^/]+)/$ http://localhost/local_ageo.si/$1 [R=301,L]

    # Redirect external .php requests to extensionless url
    RewriteCond %{THE_REQUEST} ^(.+)\.php([#?][^\ ]*)?\ HTTP/
    RewriteRule ^(.+)\.php$ http://localhost/local_ageo.si/$1 [R=301,L]

    # Resolve .php file for extensionless php urls
    RewriteRule ^([^/.]+)$ $1.php [L]

    RewriteRule ^novice/([^/\.]+)/?$ novice.php?blabla=$1 [L]