Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/10.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 我使用的htaccess不起作用_Php_.htaccess_Mod Rewrite - Fatal编程技术网

Php 我使用的htaccess不起作用

Php 我使用的htaccess不起作用,php,.htaccess,mod-rewrite,Php,.htaccess,Mod Rewrite,我有类似的url 我想转换成 我正在使用以下代码 Options -Indexes RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^allmodels/(.*)$ /allmodels?st=$1 [NC,L] 但是这个代码不起作用 Options -Indexes RewriteEngine on RewriteCo

我有类似的url

我想转换成

我正在使用以下代码

Options -Indexes
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^allmodels/(.*)$ /allmodels?st=$1 [NC,L]
但是这个代码不起作用

   Options -Indexes
   RewriteEngine on
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule .* index.php/$1 [NC,L]

所有的设置都是正确的,我已经测试过了,htaccess正在工作。

当我使用以下代码时,该代码正在工作,但上面给出的代码不工作

   Options -Indexes
   RewriteEngine on
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule .* index.php/$1 [NC,L]

什么具体不起作用?htaccess在哪个文件夹中?根目录中的htaccess。url重写无法正常工作,因此出现了404错误。如果我使用-->RewriteRule.*index.php/$1,则代码正常工作您正在重写到/allmodels url/allmodels?st=value有效吗?您的原始uri以/index.php/开头。尝试将重写目标更改为/index.php/allmodles?st=$1