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
Apache 404重写htaccess时出错_Apache_.htaccess_Mod Rewrite - Fatal编程技术网

Apache 404重写htaccess时出错

Apache 404重写htaccess时出错,apache,.htaccess,mod-rewrite,Apache,.htaccess,Mod Rewrite,我的htaccess中有以下内容: RewriteRule ^subdir/([^/.]*)/?/([_A-Za-z0-9-]+).html/?$ index.php?action=subdir&stateid=$1 RewriteRule ^subdir/([_A-Za-z0-9-]+)/?$ index.php?action=subdir&title=$1stateid=$1&full=yes 但是,当我只收到这个 mysite/subdir 然后,Apache将

我的htaccess中有以下内容:

RewriteRule ^subdir/([^/.]*)/?/([_A-Za-z0-9-]+).html/?$ index.php?action=subdir&stateid=$1
RewriteRule ^subdir/([_A-Za-z0-9-]+)/?$ index.php?action=subdir&title=$1stateid=$1&full=yes
但是,当我只收到这个

mysite/subdir
然后,Apache将其转换为

mysite/subdir/.html
我得到一个404错误

如何捕获重定向到index.php的情况

我试过这个

RewriteRule (.*)\.html$ index.php [L]

但是它也不起作用。

为什么要用一堆重写?为什么不将所有内容重写为index.php,然后在php中解析URL并在一个地方完成所有需要的操作?我看不到任何地方可以编写
.html
,你确定在某个地方没有任何其他重写规则吗?animuson,我同意你的看法,但这是一个遗留系统,现在很难改变这一点。Jon Lin,此htaccess中存在更多内容,但仅此行中我有此特定子目录。我在index.php中调试,请求不调用它。服务器重定向到404页。我认为它与/subdir没有任何关系,例如,
RewriteRule^(.*)$$1.html
某处将导致“.html”内容附加到/subdir/