Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.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
即使存在文件/目录/位置,如何通过查询将URL重写为index.php?_Php_Apache_Url_Rewrite - Fatal编程技术网

即使存在文件/目录/位置,如何通过查询将URL重写为index.php?

即使存在文件/目录/位置,如何通过查询将URL重写为index.php?,php,apache,url,rewrite,Php,Apache,Url,Rewrite,我正试图用一个包含请求路径的查询参数将我的网站中的所有内容重写为index.php文件,但当我只是简单地执行RewriteRule^(.*)$index.php?url=$1[L]my index.php文件显示包含index.php的url时。。。 简单地说,我想键入localhost/123或localhost/123.php,并始终在url参数中获取路径部分 print\r($\u GET['url'])输出Array([url]=>index.php)无论路径部分是什么 对不起,我说的是

我正试图用一个包含请求路径的查询参数将我的网站中的所有内容重写为index.php文件,但当我只是简单地执行
RewriteRule^(.*)$index.php?url=$1[L]
my index.php文件显示包含index.php的url时。。。 简单地说,我想键入localhost/123或localhost/123.php,并始终在url参数中获取路径部分

print\r($\u GET['url'])
输出
Array([url]=>index.php)
无论路径部分是什么


对不起,我说的是英语,希望你能理解我的意思:)

试着在重写规则中使用不同的标志

而不是[L]

重写规则^(.*)$index.php?url=$1[L]

试试类似[QSA]的东西

重写规则^(.*)$index.php?url=$1[QSA]

有关不同类型标志的列表和信息,请查看Apache文档