Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/285.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 重写引擎,使其不工作,但重定向工作_Php_Html_.htaccess - Fatal编程技术网

Php 重写引擎,使其不工作,但重定向工作

Php 重写引擎,使其不工作,但重定向工作,php,html,.htaccess,Php,Html,.htaccess,我想重定向到某个页面,需要删除url末尾的尾斜杠 RedirectMatch 301^/product/?$/product.html//工作正常,但在添加以下代码后,停止重定向所有重定向匹配 RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)/$ /$1 [L,R=301] 为什么它不起作用。在conf文件中添加了AllowOverwrite All@anubhava获得预期的内部服务器错误。因此

我想重定向到某个页面,需要删除url末尾的尾斜杠

RedirectMatch 301^/product/?$/product.html
//工作正常,但在添加以下代码后,停止重定向所有重定向匹配

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d   
RewriteRule ^(.*)/$ /$1 [L,R=301]

为什么它不起作用。在conf文件中添加了AllowOverwrite All

@anubhava获得预期的内部服务器错误。因此,我的htaccess已启用Maybe
mod_rewrite
未启用installed@treyBake-它们使用
R=301
标志;)@CD001你知道的越多:p看起来很奇怪,感觉我更喜欢重定向到重定向,重写到重写:S但我想有一些明确的情况,在哪里使用rewrite和FLAGR?你到底想重定向什么?这与我在dev box上期望的一样,例如
http://127.0.0.1/does-not-exist/
重定向到
http://127.0.0.1/does-not-exist
引发404错误;请求的文件不存在,而且由于现在没有尾随斜杠,重写规则不会第二次触发。@anubhava获得预期的内部服务器错误。因此,my htaccess已启用Maybe
mod_rewrite
未启用installed@treyBake-它们使用
R=301
标志;)@CD001你知道的越多:p看起来很奇怪,感觉我更喜欢重定向到重定向,重写到重写:S但我想有一些明确的情况,在哪里使用rewrite和FLAGR?你到底想重定向什么?这与我在dev box上期望的一样,例如
http://127.0.0.1/does-not-exist/
重定向到
http://127.0.0.1/does-not-exist
引发404错误;请求的文件不存在,并且由于现在没有尾随斜杠,所以重写规则不会第二次触发。