Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/280.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
Php apache htaccess codeigniter查询字符串到路径_Php_String_Codeigniter_Path - Fatal编程技术网

Php apache htaccess codeigniter查询字符串到路径

Php apache htaccess codeigniter查询字符串到路径,php,string,codeigniter,path,Php,String,Codeigniter,Path,我正在尝试使一个基于codeigniter的网站能够使用.htaccess将index.php?option=test&controller=con1转换为/test/con1。我尝试了多个我发现的示例,但似乎都不起作用,它直接进入主页。有什么想法吗 我试过这样的方法 RewriteCond %{QUERY_STRING} ^(\w+)=(\w+)$ RewriteRule ^\/(.+?)\/(.+?)\/? /index.php/$1/$2 [L] 但不会抛出任何错误或任何东西。 我目

我正在尝试使一个基于codeigniter的网站能够使用.htaccess将index.php?option=test&controller=con1转换为/test/con1。我尝试了多个我发现的示例,但似乎都不起作用,它直接进入主页。有什么想法吗

我试过这样的方法

RewriteCond %{QUERY_STRING} ^(\w+)=(\w+)$
RewriteRule ^\/(.+?)\/(.+?)\/?   /index.php/$1/$2 [L]
但不会抛出任何错误或任何东西。 我目前的htacces是

RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|img|js|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php/$1 [L]

尝试将此.htaccess与index.php放在同一目录中

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

将其中一个重写条件移动到另一个位置?只需尝试用上面提供的替换您当前的htaccess。好的,我这样做了,但没有看到任何差异,仍然忽略GET参数。