Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.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
使用带有两个以上GET变量的.htaccess在php中重写Url_Php_.htaccess_Url Rewriting_Getparameter - Fatal编程技术网

使用带有两个以上GET变量的.htaccess在php中重写Url

使用带有两个以上GET变量的.htaccess在php中重写Url,php,.htaccess,url-rewriting,getparameter,Php,.htaccess,Url Rewriting,Getparameter,我的网址是: http://example.com/demo/my_list.php?id=122&name=test files 不希望将此更改为: http://example.com/demo/my_list.php/test files/122 目前我的htaccess如下所示: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d Rew

我的网址是:

 http://example.com/demo/my_list.php?id=122&name=test files
不希望将此更改为:

 http://example.com/demo/my_list.php/test files/122
目前我的htaccess如下所示:

 RewriteEngine on

 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule ^([^/]+)$ index.php?id=$1 [L]

 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule ^([^/]+)/([^/]+)$ my_list.php?id=$1&name=$2 [L]
但它不起作用

如何用两个以上的GET变量在php中重写url

我把htaccess文件放在哪里了?在“demo”文件夹中还是根路径中

请任何人帮忙

像这样使用它

RewriteRule ^my_list\.php/([^/]+)/([^/]+)$ my_list.php?id=$2&name=$1 [L]
这样用,

RewriteRule ^my_list\.php/([^/]+)/([^/]+)$ my_list.php?id=$2&name=$1 [L]

带空格的url无效。您是否手动写入url?!不是故意的,它来自数据库..那个带有空格的url无效。你是在手动编写url吗?!不正常,它来自db..抱歉,不工作,.htaccess文件是放在demo文件夹还是根文件夹中?在demo中使用它。是的,我将htaccess文件放在demo文件夹中,但它不工作请立即尝试,无需重写条件。抱歉,不工作,.htaccess文件是放在demo文件夹中还是根文件夹中?在demo中使用它。是的,我将htaccess文件放在demo文件夹中,但它不起作用。请在没有重写条件的情况下立即尝试。